using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class ExempleAnchorLeftTop : System.Windows.Forms.Form { private System.Windows.Forms.Button bouton; public ExempleAnchorLeftTop() { InitializeComponent(); CenterToScreen(); } private void InitializeComponent() { this.bouton = new System.Windows.Forms.Button(); this.Controls.AddRange(new System.Windows.Forms.Control[] {this.bouton}); this.Text = "Anchoring des Controles: Style haut à gauche"; bouton.Anchor = AnchorStyles.Top | AnchorStyles.Left; bouton.Text = "Anchor: " + bouton.Anchor.ToString() + "Dock: " + bouton.Dock.ToString(); this.bouton.Click += new System.EventHandler(this.bouton_Click); } private void bouton_Click(object sender, System.EventArgs e) { MessageBox.Show("Exemple 'Anchoring': Style haut à gauche"); } static void Main() { Application.Run(new ExempleAnchorLeftTop()); } } |
0