Handles displaying grid this is not enabled

Added MyDisablePanel vlnPanel control
Added ApplDisplayMode property to StepPanel class
Added vlnPanel class
This commit is contained in:
Rich 2012-12-04 23:08:43 +00:00
parent 2549984e63
commit d29f45d322
5 changed files with 138 additions and 3 deletions

View File

@ -35,6 +35,7 @@ namespace Volian.Controls.Library
this.lblTab = new System.Windows.Forms.Label();
this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip();
this._MyFlexGrid = new Volian.Controls.Library.VlnFlexGrid(this.components);
this._MyDisablePanel = new vlnPanel();
((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).BeginInit();
this.SuspendLayout();
//
@ -69,12 +70,19 @@ namespace Volian.Controls.Library
this._MyFlexGrid.Size = new System.Drawing.Size(314, 66);
this._MyFlexGrid.StyleInfo = resources.GetString("_MyFlexGrid.StyleInfo");
this._MyFlexGrid.TabIndex = 4;
//
// _MyDisablePanel
//
_MyDisablePanel.BackColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ButtonFace);
_MyDisablePanel.SendToBack();
_MyDisablePanel.Visible = false;
//
// GridItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this._MyFlexGrid);
this.Controls.Add(this._MyDisablePanel);
this.Controls.Add(this.lblTab);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "GridItem";
@ -89,5 +97,6 @@ namespace Volian.Controls.Library
private System.Windows.Forms.Label lblTab;
private DevComponents.DotNetBar.SuperTooltip _MyToolTip;
private VlnFlexGrid _MyFlexGrid;
private vlnPanel _MyDisablePanel;
}
}

View File

@ -360,7 +360,44 @@ namespace Volian.Controls.Library
#endregion
#region Override Method and Properties
public override int BorderWidth { get { return (MyFlexGrid.Width - MyFlexGrid.ClientRectangle.Width); } }
//private bool _OnlyOnce = false;
//protected override void OnPaint(PaintEventArgs e)
//{
// base.OnPaint(e);
// if (!this.Enabled && !_OnlyOnce)
// {
// _OnlyOnce = true;
// _MyDisablePanel.SendToBack();
// _MyDisablePanel.BringToFront();
// _OnlyOnce = false;
// }
//}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
if (this.Enabled)
{
_MyDisablePanel.SendToBack();
_MyDisablePanel.Visible = false;
}
else
{
_MyDisablePanel.Visible = true;
Rectangle rect = new Rectangle(0, 0, this.MyFlexGrid.Width, this.MyFlexGrid.Height);
Bitmap bmp = new Bitmap(this.MyFlexGrid.Width, this.MyFlexGrid.Height);
this.MyFlexGrid.DrawToBitmap(bmp, rect);
using (Graphics gr = Graphics.FromImage(bmp))
{
gr.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
gr.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.FromKnownColor(KnownColor.ButtonFace))), rect);
//gr.FillEllipse(Brushes.Red, 10, 10, 10, 10);
}
_MyDisablePanel.Location = this.MyFlexGrid.Location;
_MyDisablePanel.Size = this.MyFlexGrid.Size;
_MyDisablePanel.BackgroundImage = bmp;
_MyDisablePanel.BringToFront();
}
}
public override Point ContentLocation
{
get { return new Point(Location.X + MyFlexGrid.Left, Location.Y); }

View File

@ -48,7 +48,30 @@ namespace Volian.Controls.Library
if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null;
return _LookupEditItems[itemInfo.ItemID];
}
private int _ApplDisplayMode = -1;
public int ApplDisplayMode
{
get { return _ApplDisplayMode; }
set
{
if(_ApplDisplayMode == value) return;
_ApplDisplayMode = value;
foreach (Control c in Controls)
{
EditItem ei = c as EditItem;
if (ei != null)
{
ei.Enabled = ei.MyItemInfo.IsApplicable(value);
//IItemConfig cfg = ei.MyItemInfo.MyConfig as IItemConfig;
//List<int> apples = cfg.MasterSlave_Applicability.GetFlags();
//if (value == -1 || apples.Count == 0)
// ei.Enabled = true;
//else
// ei.Enabled = apples.Contains(value);
}
}
}
}
/// <summary>
/// Currently selected ItemInfo
/// </summary>

View File

@ -2,7 +2,40 @@ using System;
namespace Volian.Controls.Library
{
partial class VlnFlexGrid
partial class vlnPanel
{
/// <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
}
partial class VlnFlexGrid
{
/// <summary>
/// Required designer variable.

View File

@ -22,6 +22,39 @@ namespace Volian.Controls.Library
public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args);
public delegate string VlnFlexGridPasteEvent(object sender, VlnFlexGridPasteEventArgs args);
public delegate void VlnFlexGridkeyEvent(object sender, KeyEventArgs args);
public partial class vlnPanel : Panel
{
private int _Opacity = 128;
//public int Opacity
//{
// get { return _Opacity; }
// set { _Opacity = value; }
//}
public vlnPanel()
{
InitializeComponent();
}
public vlnPanel(IContainer container)
{
container.Add(this);
InitializeComponent();
}
//protected override CreateParams CreateParams
//{
// get
// {
// CreateParams prams = base.CreateParams;
// prams.ExStyle |= 0x020; // transparent
// return prams;
// }
//}
//protected override void OnPaint(PaintEventArgs pe)
//{
// pe.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(_Opacity, this.BackColor)), this.ClientRectangle);
//}
}
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
{