動くコード図鑑技術記事現場の渡り方キャリア論すべての記事About
C#

実際にCustomOpenFileDialogを作ってみる。

出典: C#でOpenFileDialogが継承できない?それならフィールドに持っちゃえばいいんじゃね?実際にCustomOpenFileDialogを作ってみる。

実際にCustomOpenFileDialogを作ってみる。 (csharp)#cfb43496e568
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace CustomOpenFileDialog
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    private void button1_Click(object sender, EventArgs e)
    {
        var cofd = new CustomOpenFileDialog();
        if (cofd.ShowDialog() == DialogResult.OK)
        {
            textBox1.Text = cofd.FileName;
        }
    }
}
▸ この snippet は実行結果未収録
▸ 実行結果は未収録です
  • id: #cfb43496e568
  • lines: 27
  • extracted: 2026-06-10

Source収録記事

この snippet は記事の「実際にCustomOpenFileDialogを作ってみる。」セクションに登場する。コードの前後の文脈・ハマりどころの解説は記事本文で。

同じ記事から

4
図鑑トップ