HatchBrush.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // System.Drawing.Drawing2D.HatchBrush.cs
  3. //
  4. // Authors:
  5. // Dennis Hayes ([email protected])
  6. // Ravindra ([email protected])
  7. //
  8. // (C) 2002/3 Ximian, Inc
  9. // (C) 2004 Novell, Inc.
  10. //
  11. using System;
  12. namespace System.Drawing.Drawing2D
  13. {
  14. /// <summary>
  15. /// Summary description for HatchBrush.
  16. /// </summary>
  17. public sealed class HatchBrush : Brush
  18. {
  19. internal HatchBrush (IntPtr ptr) : base (ptr)
  20. {
  21. }
  22. public HatchBrush (HatchStyle hatchStyle, Color foreColor)
  23. : this (hatchStyle, foreColor, Color.Black)
  24. {
  25. }
  26. public HatchBrush(HatchStyle hatchStyle, Color foreColor, Color backColor)
  27. {
  28. Status status = GDIPlus.GdipCreateHatchBrush (hatchStyle, foreColor.ToArgb (), backColor.ToArgb (), out nativeObject);
  29. GDIPlus.CheckStatus (status);
  30. }
  31. public Color BackgroundColor {
  32. get {
  33. int argb;
  34. Status status = GDIPlus.GdipGetHatchBackgroundColor (nativeObject, out argb);
  35. GDIPlus.CheckStatus (status);
  36. return Color.FromArgb (argb);
  37. }
  38. }
  39. public Color ForegroundColor {
  40. get {
  41. int argb;
  42. Status status = GDIPlus.GdipGetHatchForegroundColor (nativeObject, out argb);
  43. GDIPlus.CheckStatus (status);
  44. return Color.FromArgb (argb);
  45. }
  46. }
  47. public HatchStyle HatchStyle {
  48. get {
  49. HatchStyle hatchStyle;
  50. Status status = GDIPlus.GdipGetHatchStyle (nativeObject, out hatchStyle);
  51. GDIPlus.CheckStatus (status);
  52. return hatchStyle;
  53. }
  54. }
  55. public override object Clone ()
  56. {
  57. return new HatchBrush (NativeObject);
  58. }
  59. }
  60. }