Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Fonts and Colors

Fonts and Colors

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    The_Server
    wrote on last edited by
    #1

    Hi all :rose: =-=-=-=-= Can anyone tell me... how can I change the font color of a button in my NOT MFC JUST WIN32 Application. The button id is :IDC_BUTTON1 Thanks. =-=-=-=-=-=-= The_Server :rose:

    S A A _ 4 Replies Last reply
    0
    • T The_Server

      Hi all :rose: =-=-=-=-= Can anyone tell me... how can I change the font color of a button in my NOT MFC JUST WIN32 Application. The button id is :IDC_BUTTON1 Thanks. =-=-=-=-=-=-= The_Server :rose:

      S Offline
      S Offline
      Simon W 0
      wrote on last edited by
      #2

      set the owndraw style to your button and catch the WM_DRAWITEN message of your dialog,then draw the button yourself I am seeking... For what? Why did you ask me for what? I don't know!

      1 Reply Last reply
      0
      • T The_Server

        Hi all :rose: =-=-=-=-= Can anyone tell me... how can I change the font color of a button in my NOT MFC JUST WIN32 Application. The button id is :IDC_BUTTON1 Thanks. =-=-=-=-=-=-= The_Server :rose:

        A Offline
        A Offline
        Anna Jayne Metcalfe
        wrote on last edited by
        #3

        You'll have to owner draw it, I'm afraid...this is a long standing omission of Win32. There are MFC classes to do this, but if you're working on raw Win32 you'll probably have to roll your own. If you do this, remember you could be running on a themed XP system so you'll need to implement both conventional (GDI) drawing and themed (UxTheme.dll) drawing. UxTheme is actually fun to work with (unlike GDI), so don't shy away from it... Anna :rose: Homepage | My life in tears "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work. Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In

        1 Reply Last reply
        0
        • T The_Server

          Hi all :rose: =-=-=-=-= Can anyone tell me... how can I change the font color of a button in my NOT MFC JUST WIN32 Application. The button id is :IDC_BUTTON1 Thanks. =-=-=-=-=-=-= The_Server :rose:

          A Offline
          A Offline
          armentage
          wrote on last edited by
          #4

          Unlike every other UI system in the world, you can't "set" the color of a Win32 control. Rather, you need to implement a WM_CTLCOLOR message handler in the Button's parent, and respond to it appropriately (check out MSDN for info.) Fonts are much simpler. In your dialog's WM_INITDIALOG, after calling the base class message handler, do a GetDlgItem(IDC_BUTTON1)->SetFont(yourfont); Make sure you keep the font handle around (i.e. don't create a CFont on the stack).

          1 Reply Last reply
          0
          • T The_Server

            Hi all :rose: =-=-=-=-= Can anyone tell me... how can I change the font color of a button in my NOT MFC JUST WIN32 Application. The button id is :IDC_BUTTON1 Thanks. =-=-=-=-=-=-= The_Server :rose:

            _ Offline
            _ Offline
            _skidrow_vn_
            wrote on last edited by
            #5

            LOGFONT lf={0,0,0,0,0,0,0,0,0,0,0,0,0,"Times New Roman"}; HWND hwndButton=GetDlgItem(hDlg, IDC_BUTTON1); ret=SendMessage(hwndButton,WM_SETFONT,(WPARAM)lf, (LPARAM)TRUE); if ret = zero >> faile okay ?;P

            T 1 Reply Last reply
            0
            • _ _skidrow_vn_

              LOGFONT lf={0,0,0,0,0,0,0,0,0,0,0,0,0,"Times New Roman"}; HWND hwndButton=GetDlgItem(hDlg, IDC_BUTTON1); ret=SendMessage(hwndButton,WM_SETFONT,(WPARAM)lf, (LPARAM)TRUE); if ret = zero >> faile okay ?;P

              T Offline
              T Offline
              The_Server
              wrote on last edited by
              #6

              10x but my problem is with color.... evryone says owner draw owner draw. guess I'll have to own and draw... =-=-=-=-=-= The Server :rose:

              _ 1 Reply Last reply
              0
              • T The_Server

                10x but my problem is with color.... evryone says owner draw owner draw. guess I'll have to own and draw... =-=-=-=-=-= The Server :rose:

                _ Offline
                _ Offline
                _skidrow_vn_
                wrote on last edited by
                #7

                http://www.vnpal.com/skidrow/zip/subclass.zip try this example I am a beginner! :(

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups