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. text color and font

text color and font

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorial
7 Posts 3 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.
  • N Offline
    N Offline
    no_life
    wrote on last edited by
    #1

    hello ppl, i am making a very simple program that is a window application. pretty much a basic hello world program to just get myself started and i have the program set up. its written in c++ and compiled with visual basic 6.0 my question is how do you pick text colors and font size? i also have a couple console programs (they open with a dos command prompt) and i would like to know how to do it in those as well. its been making me insane cause its taking so long to find something as simple as the code to change text color. mabie i would even like to add a next page to it so u can toggle pages, but i want to take it one thing at a time and try and figure this color thing out first. i would appreciate any help or advise, thank you.

    A 1 Reply Last reply
    0
    • N no_life

      hello ppl, i am making a very simple program that is a window application. pretty much a basic hello world program to just get myself started and i have the program set up. its written in c++ and compiled with visual basic 6.0 my question is how do you pick text colors and font size? i also have a couple console programs (they open with a dos command prompt) and i would like to know how to do it in those as well. its been making me insane cause its taking so long to find something as simple as the code to change text color. mabie i would even like to add a next page to it so u can toggle pages, but i want to take it one thing at a time and try and figure this color thing out first. i would appreciate any help or advise, thank you.

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      How did you write it in C++ and compile it in visual basic? Visual Basic allows you to change the color by setting the window/form object property...if I remember correctly...it's something like forecolor and backcolor if you want to do it dynamically at run time. Or you can play with the properties though the properties dialog box. In C++ assuming your using MFC or SDK it's a little different...there is no way to cheat and use a properties dialog box, you have to code it like the first example I gave you in visual basic.

      pDC->SetTextColor(RGB(64,128,255)); if your using MFC or
      SetTextColor(hdc, RGB(64,128,255)); if your using SDK

      As far as setting text colors at the DOS console...thats totally different. I believe in c, you had to use a library like borlands BGI library..in QBasic...I believe it was the COLOR statement. This should atleast give you a starting point to work from so long as I understand you correctly anyways... :) Cheers :) I'm drinking triples, seeing double and acting single :cool:

      J N 3 Replies Last reply
      0
      • A alex barylski

        How did you write it in C++ and compile it in visual basic? Visual Basic allows you to change the color by setting the window/form object property...if I remember correctly...it's something like forecolor and backcolor if you want to do it dynamically at run time. Or you can play with the properties though the properties dialog box. In C++ assuming your using MFC or SDK it's a little different...there is no way to cheat and use a properties dialog box, you have to code it like the first example I gave you in visual basic.

        pDC->SetTextColor(RGB(64,128,255)); if your using MFC or
        SetTextColor(hdc, RGB(64,128,255)); if your using SDK

        As far as setting text colors at the DOS console...thats totally different. I believe in c, you had to use a library like borlands BGI library..in QBasic...I believe it was the COLOR statement. This should atleast give you a starting point to work from so long as I understand you correctly anyways... :) Cheers :) I'm drinking triples, seeing double and acting single :cool:

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #3

        Hockey wrote: How did you write it in C++ and compile it in visual basic? That's what I was wondering too, but actually, I think he means in Visual Studio. :~

        **"To know what is right and not do it is the worst cowardice." -- Confucius

        FLUID UI Toolkit**

        1 Reply Last reply
        0
        • A alex barylski

          How did you write it in C++ and compile it in visual basic? Visual Basic allows you to change the color by setting the window/form object property...if I remember correctly...it's something like forecolor and backcolor if you want to do it dynamically at run time. Or you can play with the properties though the properties dialog box. In C++ assuming your using MFC or SDK it's a little different...there is no way to cheat and use a properties dialog box, you have to code it like the first example I gave you in visual basic.

          pDC->SetTextColor(RGB(64,128,255)); if your using MFC or
          SetTextColor(hdc, RGB(64,128,255)); if your using SDK

          As far as setting text colors at the DOS console...thats totally different. I believe in c, you had to use a library like borlands BGI library..in QBasic...I believe it was the COLOR statement. This should atleast give you a starting point to work from so long as I understand you correctly anyways... :) Cheers :) I'm drinking triples, seeing double and acting single :cool:

          N Offline
          N Offline
          no_life
          wrote on last edited by
          #4

          hi, thank you for your seggustions i will try the out when i get the chance. i think i did mean visual studio... its the program called microsoft visual c++ 6.0. sorry about the mixups im a coding newbie. (n00b alert) i have edited lots of good code but never really come up with my own program from scratch. I customized quake2.exe to have all kinds of new features, graphics and commands. i made my own mod for quake2 also (thats gamex86.dll). i pretty much did it all with no help or prior experience but now i want to attempt something simple as making my own little program and its a lot harder then i would have imagined. thanks again

          1 Reply Last reply
          0
          • A alex barylski

            How did you write it in C++ and compile it in visual basic? Visual Basic allows you to change the color by setting the window/form object property...if I remember correctly...it's something like forecolor and backcolor if you want to do it dynamically at run time. Or you can play with the properties though the properties dialog box. In C++ assuming your using MFC or SDK it's a little different...there is no way to cheat and use a properties dialog box, you have to code it like the first example I gave you in visual basic.

            pDC->SetTextColor(RGB(64,128,255)); if your using MFC or
            SetTextColor(hdc, RGB(64,128,255)); if your using SDK

            As far as setting text colors at the DOS console...thats totally different. I believe in c, you had to use a library like borlands BGI library..in QBasic...I believe it was the COLOR statement. This should atleast give you a starting point to work from so long as I understand you correctly anyways... :) Cheers :) I'm drinking triples, seeing double and acting single :cool:

            N Offline
            N Offline
            no_life
            wrote on last edited by
            #5

            hockey, i tried the code you gave me and it worked! thanks a lot man i really appreciate that. the line i entered was.. SetTextColor(hdc, RGB(64,128,255)); theres one thing i was wondering about... theres a white highlight to just the text, i changed the backround and text color but there is still a white backround to the text. im going to try and see if i can switch that color too thanks again.

            A 1 Reply Last reply
            0
            • N no_life

              hockey, i tried the code you gave me and it worked! thanks a lot man i really appreciate that. the line i entered was.. SetTextColor(hdc, RGB(64,128,255)); theres one thing i was wondering about... theres a white highlight to just the text, i changed the backround and text color but there is still a white backround to the text. im going to try and see if i can switch that color too thanks again.

              A Offline
              A Offline
              alex barylski
              wrote on last edited by
              #6

              SetBkMode(TRANSPARENT) I'm drinking triples, seeing double and acting single :cool:

              N 1 Reply Last reply
              0
              • A alex barylski

                SetBkMode(TRANSPARENT) I'm drinking triples, seeing double and acting single :cool:

                N Offline
                N Offline
                no_life
                wrote on last edited by
                #7

                eheh got it, i think my line was setbkcolor. i just searched the include files for the settextcolor line, and saw it right above. the program is set to draw one string. i tried to add another and i cant get it to draw the second one. i was thinking about having it show one little page of info. Then going through the menu or other button and having it display another string of info, kind of like a bunch of pages. any idea on how to do something like that? another thing that would be a cool addition would be a image added to the backround. i saw a ton of functions for the images in the include files and it would be a prayer if i actually found the right function for this. im gonna keep messing with it though and learn as i go. -later

                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