Transparent Panel control for DSOFramer. This eliminates the problem with DSOFramer not activating it's Tab.
This commit is contained in:
parent
7692c78ff0
commit
f6bb58d4d4
36
PROMS/Volian.Controls.Library/TransPanel.Designer.cs
generated
Normal file
36
PROMS/Volian.Controls.Library/TransPanel.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
partial class TransPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
61
PROMS/Volian.Controls.Library/TransPanel.cs
Normal file
61
PROMS/Volian.Controls.Library/TransPanel.cs
Normal file
@ -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>
|
||||
/// Summary description for TransPanel.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user