fppen.inc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2003 by the Free Pascal development team
  4. TFPCustomPen implementation
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { TFPCustomPen }
  12. procedure TFPCustomPen.SetMode (AValue : TFPPenMode);
  13. begin
  14. FMode := AValue;
  15. end;
  16. procedure TFPCustomPen.SetWidth (AValue : Integer);
  17. begin
  18. if AValue < 1 then
  19. FWidth := 1
  20. else
  21. FWidth := AValue;
  22. end;
  23. procedure TFPCustomPen.SetStyle (AValue : TFPPenStyle);
  24. begin
  25. FStyle := AValue;
  26. end;
  27. procedure TFPCustomPen.SetPattern (AValue : longword);
  28. begin
  29. FPattern := AValue;
  30. end;
  31. procedure TFPCustomPen.DoCopyProps (From:TFPCanvasHelper);
  32. begin
  33. with From as TFPCustomPen do
  34. begin
  35. self.Style := Style;
  36. self.Width := Width;
  37. self.Mode := Mode;
  38. self.pattern := pattern;
  39. end;
  40. inherited;
  41. end;
  42. function TFPCustomPen.CopyPen : TFPCustomPen;
  43. begin
  44. result := TFPCustomPen(self.ClassType.Create);
  45. result.DoCopyProps (self);
  46. end;