3 namespace System.Windows.Forms.PropertyGridInternal {
4 internal class PropertyGridTextBox : System.Windows.Forms.UserControl {
5 private TextBox textbox;
6 private Button dialog_button;
7 private Button dropdown_button;
9 /// Required designer variable.
11 private System.ComponentModel.Container components = null;
13 public PropertyGridTextBox() {
14 // This call is required by the Windows.Forms Form Designer.
15 InitializeComponent();
16 dropdown_button.Paint+=new PaintEventHandler(dropdown_button_Paint);
18 // TODO: Add any initialization after the InitializeComponent call
23 /// Clean up any resources being used.
25 protected override void Dispose( bool disposing ) {
27 if(components != null) {
31 base.Dispose( disposing );
34 #region Component Designer generated code
36 /// Required method for Designer support - do not modify
37 /// the contents of this method with the code editor.
39 private void InitializeComponent() {
40 this.dialog_button = new System.Windows.Forms.Button();
41 this.dropdown_button = new System.Windows.Forms.Button();
42 this.textbox = new System.Windows.Forms.TextBox();
47 this.dialog_button.Dock = System.Windows.Forms.DockStyle.Right;
48 this.dialog_button.Location = new System.Drawing.Point(256, 0);
49 this.dialog_button.Name = "dialog_button";
50 this.dialog_button.Size = new System.Drawing.Size(16, 16);
51 this.dialog_button.TabIndex = 1;
52 this.dialog_button.Text = "D";
53 this.dialog_button.Visible = false;
54 this.dialog_button.Click += new System.EventHandler(this.dialog_button_Click);
58 this.dropdown_button.Dock = System.Windows.Forms.DockStyle.Right;
59 this.dropdown_button.Location = new System.Drawing.Point(240, 0);
60 this.dropdown_button.Name = "dropdown_button";
61 this.dropdown_button.Size = new System.Drawing.Size(16, 16);
62 this.dropdown_button.TabIndex = 2;
63 this.dropdown_button.Visible = false;
64 this.dropdown_button.Click += new System.EventHandler(this.dropdown_button_Click);
68 this.textbox.AutoSize = false;
69 this.textbox.BackColor = System.Drawing.SystemColors.Window;
70 this.textbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
71 this.textbox.Dock = System.Windows.Forms.DockStyle.Fill;
72 this.textbox.Location = new System.Drawing.Point(0, 0);
73 this.textbox.Name = "textbox";
74 this.textbox.Size = new System.Drawing.Size(240, 16);
75 this.textbox.TabIndex = 3;
76 this.textbox.Text = "textbox";
78 // PropertyGridTextBox
80 this.Controls.Add(this.textbox);
81 this.Controls.Add(this.dropdown_button);
82 this.Controls.Add(this.dialog_button);
83 this.Name = "PropertyGridTextBox";
84 this.Size = new System.Drawing.Size(272, 16);
85 this.ResumeLayout(false);
90 private void dropdown_button_Click(object sender, System.EventArgs e) {
91 if (DropDownButtonClicked != null)
92 DropDownButtonClicked(this, EventArgs.Empty);
95 private void dialog_button_Click(object sender, System.EventArgs e) {
96 if (DialogButtonClicked != null)
97 DialogButtonClicked(this, EventArgs.Empty);
101 public event EventHandler DropDownButtonClicked;
102 public event EventHandler DialogButtonClicked;
104 public bool DialogButtonVisible {
106 return dialog_button.Visible;
109 dialog_button.Visible = value;
110 dropdown_button.Redraw();
113 public bool DropDownButtonVisible {
115 return dropdown_button.Visible;
118 dropdown_button.Visible = value;
119 dropdown_button.Redraw();
123 public bool ReadOnly {
125 return textbox.ReadOnly;
128 textbox.ReadOnly = value;
132 public new string Text {
137 textbox.Text = value;
141 private void dropdown_button_Paint(object sender, PaintEventArgs e)
143 ThemeEngine.Current.CPDrawComboButton(e.Graphics, dropdown_button.ClientRectangle, dropdown_button.ButtonState);