|
-
Jul 17th, 2007, 12:17 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] ComboBox ForeColor
When I set the ForeColor of my ComboBox, ALL of the text turns to that color. Is there a way to set it so that only the text in the TextBox portion of the ComboBox turns to that color, and the rest stays in black text?
-
Jul 17th, 2007, 01:59 AM
#2
Re: [2005] ComboBox ForeColor
You would have to draw the items yourself if you want to use different text colours. Check out the documentation for the DrawMode property for an explanation and code example.
-
Jul 17th, 2007, 02:21 AM
#3
Re: [2005] ComboBox ForeColor
Its called OwnerDrawn where you handle all the drawing/painting of the items in the list. You can draw in different colors, fonts, and size for each individule item if you want.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 17th, 2007, 02:27 AM
#4
Thread Starter
Hyperactive Member
Re: [2005] ComboBox ForeColor
If confusing you wish to be the speak in cryptic code you must.
-
Jul 17th, 2007, 02:29 AM
#5
Re: [2005] ComboBox ForeColor
What are you trying to say/ask?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 17th, 2007, 02:30 AM
#6
Re: [2005] ComboBox ForeColor
What's confusing or cryptic about this?
Check out the documentation for the DrawMode property for an explanation and code example.
-
Jul 17th, 2007, 02:31 AM
#7
Re: [2005] ComboBox ForeColor
After a quick search, here is an example from msdn online help pages...
http://msdn2.microsoft.com/en-us/lib....drawmode.aspx
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 17th, 2007, 02:40 AM
#8
Thread Starter
Hyperactive Member
Re: [2005] ComboBox ForeColor
Um, I was practicing my If/Then structure? Or maybe not.
All this stuff seems to come pretty easily for you guys. I assume that it's easy to forget how overwhelming it all can be.
But I know what to look at now for this. Maybe it can be done.
I'll give it a try tomorrow.
How's Australia this time of year? I know a few pedal steel players over there.
-
Jul 17th, 2007, 03:44 AM
#9
Thread Starter
Hyperactive Member
Re: [2005] ComboBox ForeColor
I've been through the code at http://msdn2.microsoft.com/en-us/lib....drawmode.aspx
Played around with it. Made it do different stuff. But I couldn't make it do what I want. I don't understand it.
All I want is a ComboBox with these items in these colors.
"Homework" (black"
"Test" (red)
"9 Weeks Test" (blue)
"Semester Test" (green)
I see that I can make the choices in the listbox section have their own colors, though I don't understand exactly how it works. And I know that I can set the ForeColor to my color of choice for the TextBox part of the ComboBox. Of course, setting that changes ALL of the text (including the choices) to that color.
-
Jul 17th, 2007, 03:50 AM
#10
Re: [2005] ComboBox ForeColor
In the example from the link I posted, your link is broken, if you look at the ComboBox1_DrawItem event you can see how it colors the three items in the combo.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 19th, 2007, 12:28 AM
#11
Thread Starter
Hyperactive Member
Re: [2005] ComboBox ForeColor
I changed a few things and experimented. Finally got the result I was wanting. Actually, something a little better. Thanks.
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
|