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. ATL / WTL / STL
  4. pass ColorPicker value to a COLORREF variable

pass ColorPicker value to a COLORREF variable

Scheduled Pinned Locked Moved ATL / WTL / STL
c++graphicshelpquestion
2 Posts 1 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.
  • L Offline
    L Offline
    loid grey manuel
    wrote on last edited by
    #1

    hi guys, i'm having problem passing the value of color picker to my COLORREF variable.. my code on KEYDown Event: CGDICarSampleDlg.cpp file /* CColorDialog dlg; if (dlg.DoModal() == IDOK) { color = dlg.GetColor(); } Invalidate(); */ when the color picker apears, i just choose a color,. i created a brush on my Car.cpp file, m_brCar.CreateSolidBrush(RGB(0, 0, 255)); now my problem is this, how do pass whatever the value of chosen color to a COLORREF variable, then pass it to m_brCar.CreateSolidBrush(COLORREF variable);? so when i chose a color, my CAR DRAWING changes it's color, initialy the color is BLUE.. thanks ahead..

    L 1 Reply Last reply
    0
    • L loid grey manuel

      hi guys, i'm having problem passing the value of color picker to my COLORREF variable.. my code on KEYDown Event: CGDICarSampleDlg.cpp file /* CColorDialog dlg; if (dlg.DoModal() == IDOK) { color = dlg.GetColor(); } Invalidate(); */ when the color picker apears, i just choose a color,. i created a brush on my Car.cpp file, m_brCar.CreateSolidBrush(RGB(0, 0, 255)); now my problem is this, how do pass whatever the value of chosen color to a COLORREF variable, then pass it to m_brCar.CreateSolidBrush(COLORREF variable);? so when i chose a color, my CAR DRAWING changes it's color, initialy the color is BLUE.. thanks ahead..

      L Offline
      L Offline
      loid grey manuel
      wrote on last edited by
      #2

      ok, i resolved it on my own... using these three lines of code i was able to extract the RGB...

      r = GetRValue(color);
      g = GetGValue(color);
      b = GetBValue(color);
      

      haha... google is a friend, don't be shy to ask GOOGLE..

      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