|
-
Jul 11th, 2005, 07:57 PM
#1
Thread Starter
Member
Colorful combo box
I am making a program to calculate the resistance of a resistor. If you do not know resistors have a color code by the rings of colors. I made a combo box with all the colors printed on it but I’m looking for a way to change the colors of the text so that the text Red will be in a red font. I need every color to be different in the same combo box. Is this possible? If so how?
-
Jul 11th, 2005, 08:05 PM
#2
Re: Colorful combo box
yea it's possible. You need to search for "owner drawn combo box" and read some basic articles. You have to change the DrawMode property of your combo box and do the drawing manually. Search on www.codeproject.com perhaps
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 12th, 2005, 10:24 PM
#3
Thread Starter
Member
Re: Colorful combo box
I can’t seem to find any thing related to visual basic. A lot of C# and C++.
-
Jul 12th, 2005, 11:14 PM
#4
Re: Colorful combo box
don't have time right now otherwise I'd just do it
a quick search... see if it helps
http://www.devx.com/dotnet/Article/8014/0/page/3
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 13th, 2005, 09:45 PM
#5
Thread Starter
Member
Re: Colorful combo box
Ok I am a beginner to visual basic or programming in general. I have never done an owner drawn combo box before. This is all new to me. I have a list of colors I need. I do like the link you gave me but I just don’t understand it.
The colors I need are:
Black, Brown, Red, Orange, Yellow, Green, Blue, Violet, Grey, White. I would prefer it to be in this order, because the index number works well with the math. But I can do it other ways.
If anyone can find me a better example, or have time to write some code I would greatly apprentice it.
-
Jul 13th, 2005, 10:57 PM
#6
Lively Member
Re: Colorful combo box
VB Code:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim cboSender As ComboBox
cboSender = CType(sender, ComboBox)
Select Case cboSender.SelectedIndex
Case Color.Black
cboSender.BackColor = System.Drawing.Color.Black
Case Color.Brown
cboSender.BackColor = System.Drawing.Color.Brown
Case Color.Red
cboSender.BackColor = System.Drawing.Color.Red
Case Color.Orange
cboSender.BackColor = System.Drawing.Color.Orange
Case Color.Yellow
cboSender.BackColor = System.Drawing.Color.Yellow
'rest of the cases
End Select
End Sub
Private Enum Color
Black
Brown
Red
Orange
Yellow
Green
Blue
Violet
Gray
White
End Enum
-
Jul 14th, 2005, 11:47 AM
#7
Thread Starter
Member
Re: Colorful combo box
I hope I’m not being too picky, what I really want is the text color to change for every item when you pull it down, not after you select an item. But I do like the ideal of changing the back color meboz. I can use that for another program.
I guess it is not that important, it would be nice if we could get it to work that way, and it doesn’t serve any practical purpose just for looks.
-
Jul 14th, 2005, 04:34 PM
#8
Lively Member
Re: Colorful combo box
For the text color to be different for each item you need to do what MrPolite has suggested : )
PS. If we weren't picky, we wouldn't be programmers...
-
Jul 14th, 2005, 10:52 PM
#9
Thread Starter
Member
Re: Colorful combo box
Ok, that makes me feel better, but can any one explain to me how I can do this in a better way then the site does. Code with comments would be great.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|