using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace WindowsApplication1 { /// /// Form1 の概要の説明です。 /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; /// /// 必要なデザイナ変数です。 /// private System.ComponentModel.Container components = null; public Form1() { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); // // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。 // } /// /// 使用されているリソースに後処理を実行します。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows フォーム デザイナで生成されたコード /// /// デザイナ サポートに必要なメソッドです。このメソッドの内容を /// コード エディタで変更しないでください。 /// private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(18, 16); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(256, 32); this.button1.TabIndex = 0; this.button1.Text = "タイトルバーのないダイアログを表示"; this.button1.Click += new System.EventHandler(this.button1_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } #endregion /// /// アプリケーションのメイン エントリ ポイントです。 /// [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { NoTitleDlg dlg = new NoTitleDlg(); // センタリングした位置を計算 int x = this.Location.X + (this.Size.Width - dlg.Size.Width) / 2; int y = this.Location.Y + (this.Size.Height - dlg.Size.Height) / 2; dlg.Show(); dlg.Location = new Point(x, y); for (int i = 0; i < 100; i++) { System.Threading.Thread.Sleep(10); Application.DoEvents(); } dlg.Close(); } } }