diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-11-06 13:46:59 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-11-06 13:46:59 +0000 |
commit | eb820c5ad4574d7394652ed724f89aa5b7ae4e3d (patch) | |
tree | 6ce3e6ae1c15b4b357175007919ec39fbded9884 /src/corelib | |
parent | d3d2a9b7658dd7f1c2521bad60c7b97af67bdfcf (diff) | |
download | fpGUI-eb820c5ad4574d7394652ed724f89aa5b7ae4e3d.tar.xz |
* Fixed the SetLineStyle issue under GDI. lsDot now draws
correctly and so does lsDash.
* Fixed the issue with LineWidth not working
for Canvas.DrawLine under GDI.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index 6c190a90..e35023ba 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -1295,10 +1295,13 @@ var SX, SY, EX, EY: Longint; begin {Stupid GDI can't tell the difference between 0 and 360°!!} - if a2 = 0 then exit; + if a2 = 0 then + Exit; //==> {Stupid GDI must be told in which direction to draw} - if a2 < 0 then Windows.SetArcDirection(FGc,AD_CLOCKWISE) - else Windows.SetArcDirection(FGc,AD_COUNTERCLOCKWISE); + if a2 < 0 then + Windows.SetArcDirection(FGc, AD_CLOCKWISE) + else + Windows.SetArcDirection(FGc, AD_COUNTERCLOCKWISE); Angles2Coords(x, y, w, h, a1*16, a2*16, SX, SY, EX, EY); {$IFNDEF wince} Windows.Arc(Fgc, x, y, x+w, y+h, SX, SY, EX, EY); @@ -1310,10 +1313,13 @@ var SX, SY, EX, EY: Longint; begin {Stupid GDI can't tell the difference between 0 and 360°!!} - if a2 = 0 then exit; + if a2 = 0 then + Exit; //==> {Stupid GDI must be told in which direction to draw} - if a2 < 0 then Windows.SetArcDirection(FGc,AD_CLOCKWISE) - else Windows.SetArcDirection(FGc,AD_COUNTERCLOCKWISE); + if a2 < 0 then + Windows.SetArcDirection(FGc, AD_CLOCKWISE) + else + Windows.SetArcDirection(FGc, AD_COUNTERCLOCKWISE); Angles2Coords(x, y, w, h, a1*16, a2*16, SX, SY, EX, EY); {$IFNDEF wince} Windows.Pie(Fgc, x, y, x+w, y+h, SX, SY, EX, EY); @@ -1451,38 +1457,36 @@ begin end; procedure TfpgCanvasImpl.DoSetLineStyle(awidth: integer; astyle: TfpgLineStyle); +const + cDot: array[1..2] of DWORD = (1, 1); + cDash: array[1..4] of DWORD = (4, 2, 4, 2); var lw: integer; + logBrush: TLogBrush; begin -{ Notes from MSDN: If the value specified by nWidth is greater -than 1, the fnPenStyle parameter must be PS_NULL, PS_SOLID, or -PS_INSIDEFRAME. } FLineWidth := awidth; + logBrush.lbStyle := BS_SOLID; + logBrush.lbColor := FWindowsColor; + logBrush.lbHatch := 0; + DeleteObject(FPen); case AStyle of lsDot: begin - FintLineStyle := PS_DOT; - lw := 1; + FPen := ExtCreatePen(PS_GEOMETRIC or PS_ENDCAP_FLAT or PS_USERSTYLE, FLineWidth, logBrush, Length(cDot), @cDot); end; lsDash: begin - FintLineStyle := PS_DASH; - lw := 1; + FPen := ExtCreatePen(PS_GEOMETRIC or PS_ENDCAP_FLAT or PS_USERSTYLE, FLineWidth, logBrush, Length(cDash), @cDash); end; lsSolid: begin - FintLineStyle := PS_SOLID; - lw := FLineWidth; + FPen := CreatePen(PS_SOLID, FLineWidth, FWindowsColor); end; else begin - FintLineStyle := PS_SOLID; - lw := 1; + FPen := CreatePen(PS_SOLID, FLineWidth, FWindowsColor); end; end; - - DeleteObject(FPen); - FPen := CreatePen(FintLineStyle, lw, FWindowsColor); SelectObject(Fgc, FPen); end; |