| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
change color and font push button VC6
Hi all,
I'm a beginner in VC++. I used Dialog Based Project with Visual C++ 6.0. Please help me, how to change color and font of push button in visual C++ 6.0? Any reference that I can learn? I used dialog based project. I have tried to change my button tipe to Owner Draw and use this codes, but failed. //code start here HBRUSH CGambarDlg::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() == IDC_BUTTON1 ) { // Set color as red. CBrush bbutton; pDC->SetBkColor( RGB( 0, 255, 0 )); bbutton.CreateSolidBrush(RGB(0,255,0)); pDC->SelectObject(&bbutton); //pDC->SetBkMode( TRANSPARENT ); } // TODO: Return a different brush if the default is not desired return hbr; } //code end here. help me please.... thanks and regards, Eka Candra |
|
#2
|
||||
|
||||
|
Re: change color and font push button VC6
To change font you usually use CWnd::SetFont
To change button color - use owner draw button. See the example in Colored Buttons
__________________
Victor Nijegorodov
|
|
#3
|
|||
|
|||
|
Re: change color and font push button VC6
thank you for those help...
thanks a lot... |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|