|
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data;
namespace OD_LV { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.ComboBox comboBox1; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; static int delta = 5 ;
public Form1() { // // Required for Windows Form Designer support // InitializeComponent();
// // TODO: Add any constructor code after InitializeComponent call // }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Required method for Designer support – do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.comboBox1 = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // // comboBox1 // this.comboBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple; this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(496, 397); this.comboBox1.TabIndex = 0; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); this.comboBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.comboBox1_DrawItem); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(496, 397); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.comboBox1}); this.Name = "Form1"; this.Text = "Owner Draw Combo Box"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false);
} #endregion
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }
private void Form1_Load(object sender, System.EventArgs e) { comboBox1.ItemHeight = 35 ; comboBox1.Items.Add("STRING1"); comboBox1.Items.Add("STRING2"); comboBox1.Items.Add("STRING3"); comboBox1.Items.Add("STRING4"); comboBox1.Items.Add("STRING5"); comboBox1.Items.Add("STRING6"); comboBox1.Items.Add("STRING7"); } ………………………. ………………………. ………………………. ………………………. ………………………. ………………………. ……………………….
} }
|
No comments yet... Be the first to leave a reply!