Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 22nd, 2005, 10:07 AM   #1
dragonx
Newbie
 
Join Date: Aug 2005
Posts: 1
Rep Power: 0 dragonx is on a distinguished road
customise TextBox control

When a Windows control such as TextBox or ComboBox is disabled it uses default system colours for the Backcolor and Forecolor attributes. How can I customise these controls to override these attributes. For example, I want the text font to be bold and black when in a disabled state.

thanks
dragonx is offline   Reply With Quote
Old Aug 23rd, 2005, 2:09 PM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Well I find that if the colours are non-system ones, the textbox takes those regardless of whether it's enabled or not, so you'd have to write some code to handle the colour changing to indicate a "greyed out" state.
Rory is offline   Reply With Quote
Old Aug 24th, 2005, 11:30 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I've never tried it myself, but this apparently works: put the control in a PictureBox and set the border to 0. Disable the PictureBox (not the TextBox), and add checking.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 27th, 2005, 12:15 AM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Quote:
Originally Posted by Ooble
I've never tried it myself, but this apparently works: put the control in a PictureBox and set the border to 0. Disable the PictureBox (not the TextBox), and add checking.
While we're talking hacks...
You could also use the EnableWindow API to just disable the window directly, or override the Enabled property Setter to prevent the repaint, so the colours aren't changed.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:30 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC