|
<br />
CPaintDC dc(this);
dc.SetTextColor(RGB(0,0,200));<br />
dc.TextOutW(10,10,_T("test"),4);<br /> and Here[^]
whitesky
|
|
|
|
|
HBRUSH CAfterone::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->GetDlgCtrlID()==/*Put your control id Here ex IDC_EDIT1*/)
// return your color brush here
// TODO: Return a different brush if the default is not desired
return hbr;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i want only to change edit box color not text color
this will change all dialog box coloto black
i want to change only edit control color but not its text color
plz tel me how this possible
Please mail me
|
|
|
|
|
Here's the code snippet : To change only the background color
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
HBRUSH hBr=CreateSolidBrush (RGB(255,0,0));
if(pWnd->GetDlgCtrlID ()== IDC_EDIT1)
{
pDC->SetBkColor (RGB(255,0,0));
hbr=hBr;
}
return hbr;
}
Is it OK!
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yogendra kaushik wrote: i want only to change edit box color not text color
this will change all dialog box coloto black
i want to change only edit control color but not its text color
plz tel me how this possible
The following code changes the color of the all the EDIT controls of the dialog CtestMFCDlg.
HBRUSH CtestMFCDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
if(nCtlColor== CTLCOLOR_EDIT )<br />
hbr=CreateSolidBrush(RGB(0,100,0));<br />
return hbr;<br />
}
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
A_Laxmanhbr=CreateSolidBrush(RGB(0,100,0));
this will generate handle leake...Isn't it?
nave
|
|
|
|
|
you need to WM_CTLCOLOREDIT message
whitesky
|
|
|
|
|
See the following answer posted in the same page...
Here[^]
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
yogendra kaushik wrote: i want to change color of a particular control
I think following code will solve ur problem
if(pWnd->GetDlgCtrlID()==IDC_EDIT1)<br />
{<br />
CRect rect;<br />
pWnd->GetClientRect(&rect);<br />
pDC->FillSolidRect(&rect,RGB(255,0,0));<br />
pWnd->ReleaseDC(pDC); <br />
}<br />
put this code in OnCtlColor ().
This wil give you desired output.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
thanks a lot
mut if i want to change color of many edit boxes then i had to use if statement for each or there is some other techniqe to sole it plz send me code
Please mail me
|
|
|
|
|
send me as early as possible
#sankar#
|
|
|
|
|
try EnumChildWindows.
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
|
Use FindWindow() or
use CWnd* GetDlgItem(int nID)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:33 Monday 19th June, 2006
|
|
|
|
|
sankarRao wrote: How we can get the handle of child window
See the following API in case of Dialog's Child window
HWND GetDlgItem( HWND hDlg, int nIDDlgItem);
what do you mean send me as early as possible ?? is this you description of your question.. please ...we are not here for providing full solutions but suggestions....we are also developers like you.
Knock out 't' from can't,
You can if you think you can
-- modified at 5:44 Monday 19th June, 2006
|
|
|
|
|
A_Laxman...we are also developers like you.
Speak for yourself.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
I am unable to find any sample code covering the change of color in text output. I would be grasteful for any pointers.
Raymond Mercier
|
|
|
|
|
I'm not sure if this is what you are asking but theForger has a nice win32 API tutorial. It can be found here:
http://www.winprog.org/tutorial/dlgfaq.html
|
|
|
|
|
RaymondM wrote: I am unable to find any sample code covering the change of color in text output. I would be grasteful for any pointers.
See the Following link.
Here[^]
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Try this out (If possible use reflect message in yours )
HBRUSH CMessaJunkDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
if (nCtlColor==CTLCOLOR_EDIT )<br />
pDC->SetTextColor (RGB(255,0,0));<br />
return hbr;<br />
}
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Thanks to the three people who replied so promptly. Of course SetTextColor and the messages like WM_CTLCOLORDLG are the obvious thing, but somehow I had never had to do it before.
Raymond Mercier
|
|
|
|
|
in OnPaint function test this code
<br />
CPaintDC dc(this);
dc.SetTextColor(RGB(0,0,200));<br />
dc.TextOutW(10,10,_T("test"),4);<br />
whitesky
|
|
|
|
|
Experts!
I have a device conected to my computer with a USB,
i want to stop this device and then start it again.
i selected disable in the device manager and the device was disable successfully.
But when i tried to do it programmaticatly it failed.
I tried calling "net stop service_name_blabla" from the command line.
and i tried using SERVICE_CONTROL_STOP,in ControlService
but they both failed, reason:
"The requested control is not valid for this service. " error
how can i disable the service with C++ like i'm doing well in the device manager ?
thanks.
|
|
|
|
|
BabyGuru wrote: a device conected to my computer with a USB
BabyGuru wrote: how can i disable the service with C++ like i'm doing well in the device manager ?
Use SetupDiSetClassInstallParams function to do this.
Maxwell Chen
|
|
|
|