ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 17th, 2002, 05:58 AM
kamarthi7 kamarthi7 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: germany
Posts: 6 kamarthi7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 22nd, 2002, 03:52 PM
JayeshJain JayeshJain is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Auckland,New Zealand
Posts: 31 JayeshJain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > how to add system colors


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway