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#
  4. Need explanation ...

Need explanation ...

Scheduled Pinned Locked Moved C#
3 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.
  • F Offline
    F Offline
    Francis Chau
    wrote on last edited by
    #1

    Does some of you could tell me what's the function of the codes below: Thanks! void DisplayShape(bool Light) { HPEN hNPen,hOPen; HBRUSH hOldBrush,hNewBrush; COLORREF cfill; if (Light) { if (cluminance == 3) return; cluminance = 3; cfill=RGB(0,255,0); } else switch(cluminance) { case 3: {cluminance--; cfill=RGB(64,255,64); break;} case 2: {cluminance--; cfill=RGB(128,255,128); break;} case 1: {cluminance--; cfill=RGB(192,255,192); break;} default: cfill=RGB(255,255,255); } hdc = GetDC(hWndG); hNPen=CreatePen(PS_SOLID,1,RGB(0,0,0)); hOPen=(HPEN)SelectObject(hdc,hNPen); hNewBrush=CreateSolidBrush(cfill); hOldBrush=(HBRUSH)SelectObject(hdc,hNewBrush); Ellipse(hdc,393,235,443,285); DeleteObject(SelectObject(hdc,hOPen)); DeleteObject(SelectObject(hdc,hOldBrush)); ReleaseDC(hWndG,hdc); }

    C 1 Reply Last reply
    0
    • F Francis Chau

      Does some of you could tell me what's the function of the codes below: Thanks! void DisplayShape(bool Light) { HPEN hNPen,hOPen; HBRUSH hOldBrush,hNewBrush; COLORREF cfill; if (Light) { if (cluminance == 3) return; cluminance = 3; cfill=RGB(0,255,0); } else switch(cluminance) { case 3: {cluminance--; cfill=RGB(64,255,64); break;} case 2: {cluminance--; cfill=RGB(128,255,128); break;} case 1: {cluminance--; cfill=RGB(192,255,192); break;} default: cfill=RGB(255,255,255); } hdc = GetDC(hWndG); hNPen=CreatePen(PS_SOLID,1,RGB(0,0,0)); hOPen=(HPEN)SelectObject(hdc,hNPen); hNewBrush=CreateSolidBrush(cfill); hOldBrush=(HBRUSH)SelectObject(hdc,hNewBrush); Ellipse(hdc,393,235,443,285); DeleteObject(SelectObject(hdc,hOPen)); DeleteObject(SelectObject(hdc,hOldBrush)); ReleaseDC(hWndG,hdc); }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It's C Code. It draws an Ellipse, and every time it is called, the colour changes. It fades up to white, but not in greyscale, the green component is always 255. Christian Graus - Microsoft MVP - C++

      F 1 Reply Last reply
      0
      • C Christian Graus

        It's C Code. It draws an Ellipse, and every time it is called, the colour changes. It fades up to white, but not in greyscale, the green component is always 255. Christian Graus - Microsoft MVP - C++

        F Offline
        F Offline
        Francis Chau
        wrote on last edited by
        #3

        Thanks!

        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