|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to add system colors
how to add system colors in a combo box when the form is loaded in VB or C# or VB.net. if the color is clicked the font color should be changed?
Last edited by kamarthi7 : October 17th, 2002 at 07:04 AM. |
|
#2
|
|||
|
|||
|
Here is the code in VB.NET to load the color in combobox
Dim asm As [Assembly] ' Assembly is reserved vb word so use the brackets to override Dim myClasses() As Type Dim myProperties() As PropertyInfo Dim myTypeInfo As Type Dim myPropertyInfo As PropertyInfo ' Lets load the System.Drawing dll asm = [Assembly].LoadWithPartialName("System.Drawing") If Not (asm Is Nothing) Then ' get an array of base classes myClasses = asm.GetTypes() End If ' Loop through each class For Each myTypeInfo In myClasses ' if it is the color class If myTypeInfo.ToString() = "System.Drawing.Color" Then ' get an array of all the properties myProperties = myTypeInfo.GetProperties() ' loop the properties For Each myPropertyInfo In myProperties ' if the property returns a Color object, then lets output it ' to the console as their are some non color properties we ' dont want to list If myPropertyInfo.PropertyType.ToString() = "System.Drawing.Color" Then ComboBox1.Items.Add(myPropertyInfo.Name) End If Next myPropertyInfo End If Next myTypeInfo |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > how to add system colors |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|