Announcement

Collapse
No announcement yet.

dashed lines

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chris Holbrook
    replied
    Pukka!

    Thanks Dominic!
    Attached Files

    Leave a comment:


  • Dominic Mitchell
    replied
    Unfortunately, you are using a cosmetic pen which draws dotted or dashed
    lines using a width of one pixel. That is, the width parameter is ignored.
    You need to use a geometric pen. The bad news, for you I guess, is that you
    cannot use the DDT graphics command for this.

    So break out the champagne, it's gonna be SDK.
    Code:
      LOCAL tps       AS PAINTSTRUCT
      LOCAL tlb       AS LOGBRUSH
      LOCAL hPen      AS DWORD
      LOCAL hPenOld   AS DWORD
    
      BeginPaint hWnd, tps
    
      ' Draw a 3-pixel width dashed line at an angle
      tlb.lbStyle = %BS_SOLID
      tlb.lbHatch = 0
      tlb.lbColor = &H00C0C0C0???   ' gray
    
      hPen = ExtCreatePen(%PS_GEOMETRIC OR %PS_DASH OR %PS_ENDCAP_FLAT OR %PS_JOIN_MITER, 3, tlb, 0, BYVAL %NULL)
    
      hPenOld = SelectObject(tps.hdc, hPen)
      MoveToEx tps.hdc, 0, 10, BYVAL %NULL
      LineTo tps.hdc, 300, 100
    
      DeleteObject SelectObject(tps.hdc, hPenOld) 
      
      EndPaint hWnd, tps

    Leave a comment:


  • Chris Holbrook
    started a topic dashed lines

    dashed lines

    Graphics is not my strong suit.

    Using a pen with the %PS_DASH style is only good for narrow (1 unit) dashed lines which look terrible when not vertical or horizontal. Also, the "missing" parts of the dashed line appear to have a white background, whereas the background across which they are drawn is grey.

    So, how do I draw a thicker dashed line? would it have to be a series of rectangles (sounds like hard work!), and how can I set the correct color for the gaps in the lines, please?
    Attached Files
Working...
X