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. Color selection

Color selection

Scheduled Pinned Locked Moved C / C++ / MFC
c++comquestion
2 Posts 2 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.
  • S Offline
    S Offline
    sidkraft
    wrote on last edited by
    #1

    I am trying to initialize a "brush" in visual C++ and then call it back and changing the colors of RGB. My statments for initialization are: CFrame::CFrame() { ... ... ... colorbar.CreateSolidBrush(RGB(a,b,c)); ... ... } void CFrame::OnPaint() { CPaintDC dc(this); dc.TextOut (5,40,"Red Color Is:"); //Output color frame COLORREF(RGB(a,b,c)); a = x; CRect rc(100,150,150,200); dc.FillSolidRect(&rc,RGB(a,250,250)); } No matter what I try, the colors only get defined at initialize time and never change. Are there functions in MFC that allow one to change the colors after initialization and what are they? Please let me know at sid_kraft@msn.com. Thanks in advance, Sid Kraft Sid

    N 1 Reply Last reply
    0
    • S sidkraft

      I am trying to initialize a "brush" in visual C++ and then call it back and changing the colors of RGB. My statments for initialization are: CFrame::CFrame() { ... ... ... colorbar.CreateSolidBrush(RGB(a,b,c)); ... ... } void CFrame::OnPaint() { CPaintDC dc(this); dc.TextOut (5,40,"Red Color Is:"); //Output color frame COLORREF(RGB(a,b,c)); a = x; CRect rc(100,150,150,200); dc.FillSolidRect(&rc,RGB(a,250,250)); } No matter what I try, the colors only get defined at initialize time and never change. Are there functions in MFC that allow one to change the colors after initialization and what are they? Please let me know at sid_kraft@msn.com. Thanks in advance, Sid Kraft Sid

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      u can change the color of CBrush. u have to delete the previous brush before creating the new brush. if( 0 != colorbar.m_hObject ) { colorbar.DeleteObject(); } colorbar.CreateSolidBrush(RGB(a,b,c)); nave

      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