Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Drawing.Drawing2D;
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- var hb = new HatchBrush(HatchStyle.Percent50, this.TransparencyKey);
- e.Graphics.FillRectangle(hb,this.DisplayRectangle);
- }
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- // Apply opacity (0 to 255)
- panel1.BackColor = Color.FromArgb(25, panel1.BackColor);
- }
- protected override void OnPaintBackground(PaintEventArgs e) {
- var hb = new HatchBrush(HatchStyle.Percent80, this.TransparencyKey);
- e.Graphics.FillRectangle(hb, this.DisplayRectangle);
- }
- protected override void OnPaintBackground(PaintEventArgs e) {
- var sb = new SolidBrush(Color.FromArgb(100, 100, 100, 100));
- e.Graphics.FillRectangle(sb, this.DisplayRectangle);
- }
Add Comment
Please, Sign In to add comment