1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66:
| ... var AFont : IGPFont; ALeftTopCorner : TGPPointF; ARect : TGPRectF; ARect1 : TGPRectF; APath : IGPGraphicsPath;
ABrush : TGPBrush; APen : TGPPen;
AText :String; Farbe1 : TGPColor; Farbe2 : TGPColor;
begin inherited;
AGraphics.SmoothingMode := SmoothingModeAntiAlias; AGraphics.TextRenderingHint := TextRenderingHintAntiAlias;
APen := TGPPen.Create(aclGray);
AGraphics.TranslateTransform(0,0); AGraphics.RotateTransform(45); if FValue then begin AText := FZustandsTextEin; Farbe1 := aclLime; Farbe2 := aclLime; end else begin AText := FZustandsTextAus; Farbe1 := aclTomato; Farbe2 := aclRed; end;
ALeftTopCorner := MakePointF( 10, 10 ); AFont := TGPFont.Create( 'Microsoft Sans Serif', FFontSize, [ fsBold ] ); ARect := AGraphics.GetStringBoundingBoxF( AText, AFont, ALeftTopCorner ); ARect1 := GPInflateRectF( ARect, 5, 5 );
AGraphics.DrawRoundRectangleF( TGPPen.Create( TGPLinearGradientBrush.Create( GPInflateRectF( ARect1, 2, 2 ), aclGray, aclDimgray, LinearGradientModeVertical ), 4 ), TGPPathGradientBrush.Create( TGPGraphicsPath.Create().AddRoundRectangleF( ARect1, MakeSizeF( 10 ) ) ).SetInterpolationColorArrays( [ aclGray, aclLightgray, aclGray ], [ 0, 0.05, 1 ] ) .SetCenterPointF( MakePointF( 250, 50 )) .SetFocusScales( 0.1, 0.8 ), ARect1, MakeSizeF( 10) ); AGraphics.DrawStringF( AText, AFont, MakePointF( 13, 13 ), TGPSolidBrush.Create( MakeARGBColor( 50, aclBlack )) ) .DrawStringF( AText, AFont, ALeftTopCorner, TGPLinearGradientBrush.Create( ARect, Farbe1, Farbe2, LinearGradientModeForwardDiagonal )); |