私は単純なはずの何かをいじっています。
私は仕事を移し、以前に使用した基本的なツールのいくつかを手に入れようとしましたが、もちろん、見るべき古い情報源がありません。
パネルを拡張して、いくつかの標準的なプロパティと機能(保存、閉じる、保存、閉じる)を追加しました。
しかし、サイズ変更時にボタンを正しく配置できません。このExtPanelをフォームに配置しましたが、サイズを変更するとボタンが消え続けるか、期待どおりに移動しません(右下でフリーズ)。
クラス
public partial class ExtPanel: UserControl
{
private System.Windows.Forms.Button btnSaveandClose;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSave;
public ExtPanel ()
{
InitializeComponent ();
}
// misc things this class does...
}
public partial class ExtPanel
{
private void InitializeComponent ()
{
this.btnSaveandClose = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// btnSaveandClose
//
this.btnSaveandClose.Location = new System.Drawing.Point(899, 689);
this.btnSaveandClose.Name = "btnSaveandClose";
this.btnSaveandClose.Size = new System.Drawing.Size(100, 30);
this.btnSaveandClose.TabIndex = 0;
this.btnSaveandClose.Text = "Save and Close";
this.btnSaveandClose.UseVisualStyleBackColor = true;
this.btnSaveandClose.Click += new System.EventHandler(this.Click_SaveandClose);
this.btnSaveandClose.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(687, 689);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 30);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.Click_Close);
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(793, 689);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 30);
this.btnSave.TabIndex = 2;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.Click_Save);
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.btnSave);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnSaveandClose);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1008, 730);
this.panel1.TabIndex = 0;
//
// ExtPanel
//
this.Controls.Add(this.panel1);
this.Name = "ExtPanel";
this.Size = this.panel1.Size;
this.Click += new System.EventHandler(this.click_this);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
}