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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to create a transparent pen?

how to create a transparent pen?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
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.
  • P Offline
    P Offline
    pritamkd
    wrote on last edited by
    #1

    Hi, I am developing a marker application. Basically allows free-hand drawing with the mouse. When i draw a line, i want the window below also to visible. I am not able to create a transparent Pen for this? i tried BS_HOLLOW, but it doesn't draw at all. hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); lb.lbColor = rgbCurrent; lb.lbHatch = NULL; lb.lbStyle = BS_SOLID; //hNewPen = CreatePen(PS_SOLID,10,rgbCurrent); //SetROP2(hdc,R2_MERGEPEN); hNewPen = ExtCreatePen(PS_GEOMETRIC,10,&lb,0,NULL); //SelectObject(hdc,CreateBrushIndirect(&lb)); //SetDCBrushColor(hdc,rgbCurrent); SelectObject(hdc,hNewPen); MoveToEx(hdc, PrevX, PrevY, NULL); LineTo(hdc, CurrX, CurrY); DeleteDC(hdc); ........ Can anyone help? Hercules

    K 1 Reply Last reply
    0
    • P pritamkd

      Hi, I am developing a marker application. Basically allows free-hand drawing with the mouse. When i draw a line, i want the window below also to visible. I am not able to create a transparent Pen for this? i tried BS_HOLLOW, but it doesn't draw at all. hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); lb.lbColor = rgbCurrent; lb.lbHatch = NULL; lb.lbStyle = BS_SOLID; //hNewPen = CreatePen(PS_SOLID,10,rgbCurrent); //SetROP2(hdc,R2_MERGEPEN); hNewPen = ExtCreatePen(PS_GEOMETRIC,10,&lb,0,NULL); //SelectObject(hdc,CreateBrushIndirect(&lb)); //SetDCBrushColor(hdc,rgbCurrent); SelectObject(hdc,hNewPen); MoveToEx(hdc, PrevX, PrevY, NULL); LineTo(hdc, CurrX, CurrY); DeleteDC(hdc); ........ Can anyone help? Hercules

      K Offline
      K Offline
      Kaworu2
      wrote on last edited by
      #2

      Hi, I don't remember it very well, but you may search SelectStockObject (NULL_PEN); //NULL_BRUSH C U later

      P 1 Reply Last reply
      0
      • K Kaworu2

        Hi, I don't remember it very well, but you may search SelectStockObject (NULL_PEN); //NULL_BRUSH C U later

        P Offline
        P Offline
        pritamkd
        wrote on last edited by
        #3

        Thanks for replying... But this code is all in Platform SDK, how do i create a NULL_PEN there. I create a BS_HOLLOW(same as BS_NULL) but it doesn't draw the line at all. Your help will be appreciated! Hercules

        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