Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Drawing;
  7. using System.Windows.Forms;
  8.  
  9. namespace WindowsFormsApp27
  10. {
  11. public class Rectangle
  12. {
  13. int x, y;
  14. int width, height; // shir an dvisota
  15. Color lineColor, fillColor;
  16. public Rectangle(int x, int y, int width, int height, Color lineColor, Color fillColor)
  17. {
  18. this.x = x;
  19. this.y = y;
  20. this.width = width;
  21. this.height = height;
  22. if (width < 0)
  23. { this.width = width * -1; }
  24. if (height < 0)
  25. { this.height = height * -1; }
  26. this.lineColor = lineColor;
  27. this.fillColor = fillColor;
  28. }
  29.  
  30. public void Draw(Graphics g)
  31. {
  32. g.FillRectangle(new SolidBrush(fillColor), x, y, width, height);
  33. g.DrawRectangle(new Pen(lineColor), x, y, width, height);
  34. }
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement