CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2
  • Faltering Windows support
  • Internet Explorer 8 Click Clever Click Safe
  • Release Candidate 2 for ASP.NET MVC 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old September 28th, 2009, 04:01 AM
    eka_candra_w eka_candra_w is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    eka_candra_w is an unknown quantity at this point (<10)
    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
    Reply With Quote
      #2    
    Old September 28th, 2009, 04:20 AM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    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
    Reply With Quote
      #3    
    Old September 28th, 2009, 05:03 AM
    eka_candra_w eka_candra_w is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    eka_candra_w is an unknown quantity at this point (<10)
    Re: change color and font push button VC6

    thank you for those help...

    thanks a lot...
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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


    All times are GMT -5. The time now is 12:38 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.