private void GetDepProperty(object sender, RoutedEventArgs e) { SpecialTextBox st = new SpecialTextBox(); st.SetValue(SpecialTextBox.DTextProperty, this.text1.Text); // 为这个依赖属性设置对象; MessageBox.Show(st.GetValue(SpecialTextBox.DTextProperty) as string); this.StuList2.GetType(); }
/// <summary> /// Overriden InitializeComponent to use a CheckedListBox instead of a ListBox. /// </summary> override protected void InitializeComponent() { grpText = new GroupBox(); lstText = new CheckedListBox(); txtText = new SpecialTextBox(); grpText.SuspendLayout(); SuspendLayout(); // // grpText // grpText.Controls.Add(lstText); grpText.Controls.Add(txtText); grpText.Dock = DockStyle.Fill; grpText.Location = new Point(0, 0); grpText.Name = "grpText"; grpText.Size = new Size(100, 200); grpText.TabIndex = 3; grpText.TabStop = false; grpText.Text = "Text"; grpText.Click += new System.EventHandler(grpText_Click); // // lstText // lstText.Anchor = (((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); lstText.FormattingEnabled = true; lstText.Location = new Point(6, 75); lstText.Margin = new Padding(3, 6, 3, 3); lstText.Name = "lstText"; lstText.Size = new Size(88, 109); lstText.TabIndex = 1; lstText.TabStop = false; // // txtText // txtText.Anchor = ((((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); txtText.Location = new Point(6, 19); txtText.Multiline = true; txtText.Name = "txtText"; txtText.Size = new Size(88, 47); txtText.TabIndex = 0; // // ColumnFirstText // AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Controls.Add(grpText); Enabled = false; MinimumSize = new Size(100, 200); Name = "ColumnFirstText"; Size = new Size(100, 200); grpText.ResumeLayout(false); grpText.PerformLayout(); ResumeLayout(false); }
private void Button1_Click(object sender, EventArgs e) { TNameTextBox.Clear(); TCompanyTextBox.Clear(); TAptTextBox.Clear(); TStreetTextBox.Clear(); TCityTextBox.Clear(); TStTextBox.Clear(); TZipTextBox.Clear(); SpecialTextBox.Clear(); ShipDateComboBox.Text = ""; LblSizeComboBox.Text = ""; //SampleCheckBox.Clear(); }