diff --git a/PROMS/Volian.Controls.Library/TransPanel.Designer.cs b/PROMS/Volian.Controls.Library/TransPanel.Designer.cs new file mode 100644 index 00000000..39431e25 --- /dev/null +++ b/PROMS/Volian.Controls.Library/TransPanel.Designer.cs @@ -0,0 +1,36 @@ +namespace Volian.Controls.Library +{ + partial class TransPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/PROMS/Volian.Controls.Library/TransPanel.cs b/PROMS/Volian.Controls.Library/TransPanel.cs new file mode 100644 index 00000000..fdc75ea2 --- /dev/null +++ b/PROMS/Volian.Controls.Library/TransPanel.cs @@ -0,0 +1,61 @@ +using System; +using System.Drawing; +//using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +//using System.Data; + +namespace Volian.Controls.Library +{ + /// + /// Summary description for TransPanel. + /// + public partial class TransPanel : Panel + { + private string _Caption = "Inactive"; + public string Caption + { + get { return _Caption; } + set { _Caption = value; InvalidateEx(); } + } + private int _Alpha = 128; + public int Alpha + { + get { return _Alpha; } + set { _Alpha = value; InvalidateEx(); } + } + public TransPanel() + { + InitializeComponent(); + } + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT + return cp; + } + } + protected void InvalidateEx() + { + if (Parent == null) + return; + Rectangle rc = new Rectangle(this.Location, this.Size); + Parent.Invalidate(rc, true); + } + protected override void OnPaintBackground(PaintEventArgs pevent) + { + //do not allow the background to be painted + } + protected override void OnPaint(PaintEventArgs e) + { + SizeF txtSize = e.Graphics.MeasureString(_Caption, this.Font); + //Use a gray rectangle to show that the underlying control is inactive + //using (Brush b2 = new SolidBrush(Color.FromArgb(_Alpha, this.BackColor))) + // e.Graphics.FillRectangle(b2, this.ClientRectangle); + using (Brush b = new SolidBrush(Color.FromArgb(_Alpha, this.ForeColor))) + e.Graphics.DrawString(_Caption, this.Font, b, this.Width - txtSize.Width, 2); + } + } +}