Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form {
- public Form1() {
- InitializeComponent();
- this.BackColor = Color.White;
- panel1.BackColor = Color.FromArgb(25, Color.Black);
- }
- protected override void OnPaint(PaintEventArgs e) {
- e.Graphics.DrawLine(Pens.Yellow, 0, 0, 100, 100);
- }
- }
- public class TransparentPanel : Panel
- {
- protected override CreateParams CreateParams
- {
- get {
- CreateParams cp = base.CreateParams;
- cp.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT
- return cp;
- }
- }
- protected override void OnPaintBackground(PaintEventArgs e)
- {
- //base.OnPaintBackground(e);
- }
- }
- Public Class TransparentPanel
- Inherits Panel
- Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
- Get
- Dim cp As CreateParams = MyBase.CreateParams
- cp.ExStyle = cp.ExStyle Or &H20 ''#WS_EX_TRANSPARENT
- Return cp
- End Get
- End Property
- Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
- ''#MyBase.OnPaintBackground(e)
- End Sub
- End Class
- public class TransparentPanel : Panel
- {
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams cp = base.CreateParams;
- cp.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT
- return cp;
- }
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- e.Graphics.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
- }
- }
- panel1.BackColor = Color.FromArgb(100, 88, 44, 55);
- panel1 = new TransparentPanel();
- panel1.BackColor = System.Drawing.Color.Transparent;
- panel1.Location = new System.Drawing.Point(0, 0);
- panel1.Name = "panel1";
- panel1.Size = new System.Drawing.Size(717, 92);
- panel1.TabIndex = 0;
- tab2.Controls.Add(panel1);
- panel1.BringToFront();
- Imports System.Windows.Forms
- Imports System.Drawing.Printing.PrintEventArgs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement