-
August 24th, 2000, 11:58 PM
#1
Coloring of edit box and button
Is there any methods to color the Edit field and Button in VC++.
-
August 25th, 2000, 12:01 AM
#2
Re: Coloring of edit box and button
Hi..
check the WM_CTLCOLOR message..
Good luck
kishk91
kishk91@hotmail.com
http://www.path.co.il
ICQ: 13610258
-
August 25th, 2000, 01:56 AM
#3
Re: Coloring of edit box and button
You can change the color of an edit, but can't change the color of a button.
To change the color of an edit:
1. Define a CBrush var in your Dialog class definition.
class CYourDlg : public Dialog
{
...
protected:
CBrush m_brush;
...
};
2. Initialize the brush in the OnInitDialog method:
BOOL CYourDlg::OnInitDialog()
{
....
m_brush.CreateSolidBrush(RGB(255,255,250)); // Light Yellow
...
}
3. Finally do this on the ID_CTLCOLOR handle, in the method WM_CTLCOLOR of your dialog:
HBRUSH CYourDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, nCtlColor);
{
...
switch(nCtlColor)
{
case CTLCOLOR_EDIT:
pDC->SetTextColor(RGB(0,0,255)); // If you want to change the text color
pDC->SetBkColor(RGB(0,255,0)); // If you want to change the background color
return m_brush; // If you want to change the edit's background color
....
}
It's not possible to change the color of a button, but you can use any ActiveX to do that, or you can look for a control in codeguru.
Good luck, and sorry for my english!
-
August 25th, 2000, 04:30 AM
#4
Re: Coloring of edit box and button
you should check out the example at maxcode.com
go here:
sourcecodes
vcpp
controls
and there it is!
it's with insource comment!
>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
Visit: http://www.maxcode.com/ for VC++ samples...
>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
[url=http://www.maxcode.com/modules.php?name=Topics] Articles [url] | [url=http://www.maxcode.com/modules.php?name=Downloads&d_op=viewdownload&cid=4]
Compilers [url] | [url=http://www.maxcode.com/modules.php?name=Downloads]Code Samples[url]
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
|