Showing the Common properties for the Multiple Controls selection
-
Actually i am having a list of controls in multiple Controls selections like Picturebox,Textbox ,Label,LinkLabel etc . Now i got Picturebox in the Multiple selection of control . In cCustomProperties Class i am having FORECOLOR ,BACKCOLOR ,FONT ,SIZE , LOCATION Common Properties class all the controls to show for multiple controls if selected in the propertygrid. Case :: 1 If i get the PICTUREBOX in the List Of Multiple Controls i want to hide the FONT,FORECOLOR,BACKCOLOR Properties and to show only LOCATION,SIZE PROPERTIES . Case :: 2 For LINKLABEL i am fixing the size of the Linklabel to 7,7 and label text as * .So if i get the linkLabel in the list of Multiple controls i want to hide the SIZE ,FORECOLOR,BACKCOLOR PROPERTIES Presently i am taking different class for all these conditions and doing Permutations & Combinations . Which is Risky THING TO DO THE THINGS . I want to Stop doing all these non-Sense things . I want to implement the way in visual studio if Multiple Controls are selected . In the PropertyGrid i get only the properties which are common to all the controls . Ex :: Consider the label and Picturebox in Multiple Selection. THE FONT PROPETY is hiding . IN THIS WAY DYNAMICALLY . Regards
-
Actually i am having a list of controls in multiple Controls selections like Picturebox,Textbox ,Label,LinkLabel etc . Now i got Picturebox in the Multiple selection of control . In cCustomProperties Class i am having FORECOLOR ,BACKCOLOR ,FONT ,SIZE , LOCATION Common Properties class all the controls to show for multiple controls if selected in the propertygrid. Case :: 1 If i get the PICTUREBOX in the List Of Multiple Controls i want to hide the FONT,FORECOLOR,BACKCOLOR Properties and to show only LOCATION,SIZE PROPERTIES . Case :: 2 For LINKLABEL i am fixing the size of the Linklabel to 7,7 and label text as * .So if i get the linkLabel in the list of Multiple controls i want to hide the SIZE ,FORECOLOR,BACKCOLOR PROPERTIES Presently i am taking different class for all these conditions and doing Permutations & Combinations . Which is Risky THING TO DO THE THINGS . I want to Stop doing all these non-Sense things . I want to implement the way in visual studio if Multiple Controls are selected . In the PropertyGrid i get only the properties which are common to all the controls . Ex :: Consider the label and Picturebox in Multiple Selection. THE FONT PROPETY is hiding . IN THIS WAY DYNAMICALLY . Regards
I've never done anything like that before, but I can think of one method that might work. Enumerate the properties of each control. Put the property names in a collection and count the name of times each property is found for each control. Now go through the collection of property names and look at their count values. If the count equals the number of controls selected, you've found your common property names.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008