controls

What are the side-affects of ensuring every control created has a handle in .NET?

安稳与你 提交于 2021-01-27 06:31:16
问题 In the past, I've suffered from a freezing issue that was the result of a Control being used to marshall calls on the UI thread before a handle has been created for that control. (See Kim Greenlee's blog for more info). Using this method - implemented recursively - I ensure all controls that are created in our application have handles when they are constructed. Specifically, this is done after the designer call to initialise the GUI for the control. My question is: Q - Aside from performance,

How to disable a TreeView control without selecting all nodes?

久未见 提交于 2021-01-27 05:01:13
问题 I don't know if this is a bug or something, but if I try to disable a TTreeView control, all the nodes become selected (grayed out)... Can anything be done to just disable the input for this control without changing the selection ? Of course, the node are not really selected, they are just visually selected, but this is annoying. 回答1: That's how the disabled control looks like when no theme is applied. You can modify it with little intervention to item drawing: procedure TForm1

panel clear everything

爱⌒轻易说出口 提交于 2021-01-14 14:08:08
问题 I would like to reset a panel to its initial state. For e.g., I set an image as background, I drew graphics on a part of the panel. I have to clear everything. How? 回答1: You have to clear the panel first panel1.Controls.Clear(); then call the initial form. panel1.Controls.Add(orig_form); 回答2: Use the following code to delete all graphics from the panel panel1.Invalidate(); If there is something you need to add to panel's initial state then after you call invalidate you again have to set those

panel clear everything

那年仲夏 提交于 2021-01-14 14:05:44
问题 I would like to reset a panel to its initial state. For e.g., I set an image as background, I drew graphics on a part of the panel. I have to clear everything. How? 回答1: You have to clear the panel first panel1.Controls.Clear(); then call the initial form. panel1.Controls.Add(orig_form); 回答2: Use the following code to delete all graphics from the panel panel1.Invalidate(); If there is something you need to add to panel's initial state then after you call invalidate you again have to set those

panel clear everything

最后都变了- 提交于 2021-01-14 14:03:51
问题 I would like to reset a panel to its initial state. For e.g., I set an image as background, I drew graphics on a part of the panel. I have to clear everything. How? 回答1: You have to clear the panel first panel1.Controls.Clear(); then call the initial form. panel1.Controls.Add(orig_form); 回答2: Use the following code to delete all graphics from the panel panel1.Invalidate(); If there is something you need to add to panel's initial state then after you call invalidate you again have to set those

WPF Specify controls' length in millimeters

可紊 提交于 2020-12-26 08:33:16
问题 These days I am working on a complex WPF application. So far it has been a good experience. But I am stuck on a point. Its a designer application and users drag custom controls on a canvas and set their properties. Currently users can specify the control's length in cm, in, px and pt. I need to give them the option of specifying control's length in millimeters. I know of LengthConverter class in WPF but it does not give us the facility to use millimeters as unit. Why is that? Why would

WPF Specify controls' length in millimeters

自作多情 提交于 2020-12-26 08:32:48
问题 These days I am working on a complex WPF application. So far it has been a good experience. But I am stuck on a point. Its a designer application and users drag custom controls on a canvas and set their properties. Currently users can specify the control's length in cm, in, px and pt. I need to give them the option of specifying control's length in millimeters. I know of LengthConverter class in WPF but it does not give us the facility to use millimeters as unit. Why is that? Why would

Loop through all Checkboxes on a form [duplicate]

不羁的心 提交于 2020-11-29 23:43:15
问题 This question already has answers here : loop over all textboxes in a form, including those inside a groupbox (4 answers) Closed 4 days ago . I need to loop through all Checkboxes on a form and get the Tag property for each. The Checkboxes are in Groupboxes, and nested Groupboxes. Code I have works for the main form, it is not getting the values from the Checkboxes in the Groupboxes ... i = 0 For Each ctrl As Control In Me.Controls If (TypeOf ctrl Is CheckBox) Then 'Resize array ReDim