Guest User

Untitled

a guest
Nov 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System.Drawing.Drawing2D;
  2.  
  3. private void Form1_Paint(object sender, PaintEventArgs e)
  4. {
  5. var hb = new HatchBrush(HatchStyle.Percent50, this.TransparencyKey);
  6.  
  7. e.Graphics.FillRectangle(hb,this.DisplayRectangle);
  8. }
  9.  
  10. public partial class Form1 : Form
  11. {
  12. public Form1()
  13. {
  14. InitializeComponent();
  15.  
  16. // Apply opacity (0 to 255)
  17. panel1.BackColor = Color.FromArgb(25, panel1.BackColor);
  18. }
  19.  
  20. protected override void OnPaintBackground(PaintEventArgs e) {
  21. var hb = new HatchBrush(HatchStyle.Percent80, this.TransparencyKey);
  22. e.Graphics.FillRectangle(hb, this.DisplayRectangle);
  23. }
  24.  
  25. protected override void OnPaintBackground(PaintEventArgs e) {
  26. var sb = new SolidBrush(Color.FromArgb(100, 100, 100, 100));
  27. e.Graphics.FillRectangle(sb, this.DisplayRectangle);
  28. }
Add Comment
Please, Sign In to add comment