一个仿QQ面板的控件,我暂时叫它SlidingGroup
最近学着做了一个仿QQ面板的自定义控件,送给和我一样喜欢控件开发却冥思苦想不得入门之法的初学者朋友们,顺便说明一下,下面的图是我从电脑上截下来的,代码不全,其间使用了另一个命名空间定义的类型,不能简单的复制,另外控件中有一个FlatStyle属性,但没有全部实现,只实现了FlatStyle.Standard;
另外,该控件有Orientation属性,可决定面板滑动的方向,并在智能标记面板中根据控件方向的不同显示不同的内容,如下面两幅图中智能标记面板中“常规”中的停靠行为。具体请参考代码中“设计时扩展”一节中的内容。
这个控件在设计阶段的选择行为是尽量模仿TabControl,如:只有在选定控件时,控件才会响应鼠标的事件,如下图所示(其实,在sliningPanel2上都有一个鼠标指针):
下面是实现的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel.Design;
using System.Drawing;
using Etonesoft.DataType.Extension;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Windows.Forms.Design;
using Etonesoft.Windows.Controls.Design;
namespace Etonesoft.Windows.Controls.CustomControls
{
[Description("提示折叠面板组,类似QQ!")]
[DisplayName("折叠面板组")]
[ToolboxItem(typeof(SlidingGroupToolItem ))]
[Designer(typeof(SlidingGroupsDesigner))]
[ComVisible(true)]
[DefaultProperty("Panels")]
[DefaultEvent("SelectedIndexChanged")]
public partial class SlidingGroup : Control
{
const int BORDERWIDTH=2;
#region 属性 Panels 定义
private CollectionBase<SlidingPanel> m_Panels = null;
/// <summary>
/// 确定获取控件当前的面板集合
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( CollectionBase<Panel> ) , "(无)" )]
[Description ( "确定获取控件当前的面板集合" )]
public CollectionBase<SlidingPanel> Panels
{
get
{
return m_Panels;
}
}
#endregion
#region 属性 SelectedIndex 定义
/// <summary>
/// 当属性SelectedIndex更改时发生
/// </summary>
public event EventHandler SelectedIndexChanged;
/// <summary>
/// 引发控件SelectedIndexChanged事件
/// </summary>
protected virtual void OnSelectedIndexChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( SelectedIndexChanged != null && SelectedIndexChanged.GetInvocationList ( ).Length > 0 )
{
SelectedIndexChanged ( this , e );
}
}
private int m_SelectedIndex = -1;
/// <summary>
/// 确定控件当前选定面板的索引
/// </summary>
[Browsable ( false )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( int ) , "-1" )]
[Description ( "确定控件当前选定面板的索引" )]
public int SelectedIndex
{
get
{
return m_SelectedIndex;
}
set
{
if ( m_SelectedIndex == value ) return;
if ( m_SelectedIndex>=0 && m_SelectedIndex<Panels.Count )
{
Panels[m_SelectedIndex ].Dock = DockStyle.None;
Panels [ m_SelectedIndex ].Location = Point.Empty;
Panels [ m_SelectedIndex ].Size = Size.Empty;
Panels[m_SelectedIndex ].Visible = false;
}
m_SelectedIndex = value;
//TODO:在下面可添加附加的操作
if ( value >= 0 && value < Panels.Count )
{
Panels [ value ].Visible = true;
Panels [ value ].Dock = DockStyle.Fill;
}
this.Invalidate ( true );
OnSelectedIndexChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 Orientation 定义
/// <summary>
/// 当属性Orientation更改时发生
/// </summary>
public event EventHandler OrientationChanged;
/// <summary>
/// 引发控件OrientationChanged事件
/// </summary>
protected virtual void OnOrientationChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( OrientationChanged != null && OrientationChanged.GetInvocationList ( ).Length > 0 )
{
OrientationChanged ( this , e );
}
}
private Orientation m_Orientation = Orientation.Vertical ;
/// <summary>
/// 确定迭件的方向
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( Orientation ) , "Vertical" )]
[Description ( "确定迭件的方向" )]
public Orientation Orientation
{
get
{
return m_Orientation;
}
set
{
if ( m_Orientation == value ) return;
Size szPanel=getPanelSize ( );
Point ptPanel=getPanelLocation ( );
m_Orientation = value;
//TODO:在下面可添加附加的操作
this.SuspendLayout ( );
if ( SelectedPanel == null )
{
int t=this.Width;
this.Width = this.Height;
this.Height = t;
}
else
{
int w=this.Width - szPanel.Width;
int h=this.Height - szPanel.Height;
this.Width = szPanel.Width + h;
this.Height = szPanel.Height + w;
SelectedPanel.Location = new Point ( ptPanel.Y , ptPanel.X );
}
this.ResumeLayout ( true );
this.Refresh ( );
OnOrientationChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 SelectedPanel 定义
/// <summary>
/// 获取或设置控件当前选定的面板
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( Panel ) , "(无)" )]
[Description ( "获取或设置控件当前选定的面板" )]
public SlidingPanel SelectedPanel
{
get
{
if ( Panels == null ) return null;
if ( Panels.Count <= 0 ) return null;
if ( SelectedIndex < 0) return null;
if ( SelectedIndex >= Panels.Count ) return null;
return Panels[SelectedIndex ];
}
set
{
if ( Panels==null||Panels.Count<0 )
{
SelectedIndex = -1;
return;
}
if ( value == null || !Panels.Contains(value))
SelectedIndex = -1;
else
SelectedIndex = Panels.IndexOf ( value );
}
}
#endregion
#region 属性 ImageList 定义
/// <summary>
/// 当属性ImageList更改时发生
/// </summary>
public event EventHandler ImageListChanged;
/// <summary>
/// 引发控件ImageListChanged事件
/// </summary>
protected virtual void OnImageListChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( ImageListChanged != null && ImageListChanged.GetInvocationList ( ).Length > 0 )
{
ImageListChanged ( this , e );
}
}
private ImageList m_ImageList = null;
/// <summary>
/// 获取或设置控件使用的ImageList
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( ImageList ) , "(无)" )]
[Description ( "获取或设置控件使用的ImageList" )]
public ImageList ImageList
{
get
{
return m_ImageList;
}
set
{
if ( m_ImageList == value ) return;
m_ImageList = value;
//TODO:在下面可添加附加的操作
this.Refresh ( );
OnImageListChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 OwnerDraw 定义
/// <summary>
/// 当属性OwnerDraw更改时发生
/// </summary>
public event EventHandler OwnerDrawChanged;
/// <summary>
/// 引发控件OwnerDrawChanged事件
/// </summary>
protected virtual void OnOwnerDrawChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( OwnerDrawChanged != null && OwnerDrawChanged.GetInvocationList ( ).Length > 0 )
{
OwnerDrawChanged ( this , e );
}
}
private bool m_OwnerDraw = false ;
/// <summary>
/// 获取或设置一个值,指示控件是由系统绘制还是由用户代码绘制
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( bool ) , "false" )]
[Description ( "获取或设置一个值,指示控件是由系统绘制还是由用户代码绘制" )]
public bool OwnerDraw
{
get
{
return m_OwnerDraw;
}
set
{
if ( m_OwnerDraw == value ) return;
m_OwnerDraw = value;
//TODO:在下面可添加附加的操作
OnOwnerDrawChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 UseVisualBorder 定义
/// <summary>
/// 当属性UseVisualBorder更改时发生
/// </summary>
[Browsable(false)]
[EditorBrowsable( EditorBrowsableState.Never)]
public event EventHandler UseVisualBorderChanged;
/// <summary>
/// 引发控件UseVisualBorderChanged事件
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected virtual void OnUseVisualBorderChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( UseVisualBorderChanged != null && UseVisualBorderChanged.GetInvocationList ( ).Length > 0 )
{
UseVisualBorderChanged ( this , e );
}
}
private bool m_UseVisualBorder = true;
/// <summary>
/// 获取或设置控件是否使用可视化的边框样式
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( bool ) , "true" )]
[Description ( "获取或设置控件是否使用可视化的边框样式" )]
public bool UseVisualBorder
{
get
{
return m_UseVisualBorder;
}
set
{
if ( m_UseVisualBorder == value ) return;
m_UseVisualBorder = value;
//TODO:在下面可添加附加的操作
this.Refresh ( );
OnUseVisualBorderChanged ( new EventArgs ( ) );
}
}
#endregion
public override System.Drawing.Rectangle DisplayRectangle
{
get
{
Rectangle rect=new Rectangle ( getPanelLocation ( ) , getPanelSize ( ) );
rect.Inflate ( -2 , -2 );
return rect;
}
}
[Browsable(true)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
this.Invalidate ( getCaptionRect ( ) );
}
}
#region 属性 TextAlign 定义
/// <summary>
/// 当属性TextAlign更改时发生
/// </summary>
public event EventHandler TextAlignChanged;
/// <summary>
/// 引发控件TextAlignChanged事件
/// </summary>
protected virtual void OnTextAlignChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( TextAlignChanged != null && TextAlignChanged.GetInvocationList ( ).Length > 0 )
{
TextAlignChanged ( this , e );
}
}
private HorizontalAlignment m_TextAlign = HorizontalAlignment.Left ;
/// <summary>
/// 确定控件文本如何对齐
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( HorizontalAlignment ) , "Left" )]
[Description ( "确定控件文本如何对齐" )]
public HorizontalAlignment TextAlign
{
get
{
return m_TextAlign;
}
set
{
if ( m_TextAlign == value ) return;
m_TextAlign = value;
//TODO:在下面可添加附加的操作
this.Refresh ( );
OnTextAlignChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 ShowCaption 定义
/// <summary>
/// 当属性ShowCaption更改时发生
/// </summary>
public event EventHandler ShowCaptionChanged;
/// <summary>
/// 引发控件ShowCaptionChanged事件
/// </summary>
protected virtual void OnShowCaptionChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( ShowCaptionChanged != null && ShowCaptionChanged.GetInvocationList ( ).Length > 0 )
{
ShowCaptionChanged ( this , e );
}
}
private bool m_ShowCaption = false ;
/// <summary>
/// 确定控件是否显示标题栏
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( bool ) , "false" )]
[Description ( "确定控件是否显示标题栏" )]
public bool ShowCaption
{
get
{
return m_ShowCaption;
}
set
{
if ( m_ShowCaption == value ) return;
m_ShowCaption = value;
//TODO:在下面可添加附加的操作
if ( SelectedPanel != null )
{
SelectedPanel.Dock = DockStyle.None;
SelectedPanel.Dock = DockStyle.Fill;
}
this.Refresh();
OnShowCaptionChanged ( new EventArgs ( ) );
}
}
#endregion
#region 事件定义
/// <summary>
/// 当OwnerDraw、ShowCaption设置为true且绘制控件标题栏时发生
/// </summary>
public event Etonesoft.Windows.Controls.Events.OwnerDrawEventHandler DrawCaption;
/// <summary>
/// 引发控件DrawCaption事件
/// </summary>
protected virtual void OnDrawCaption ( Etonesoft.Windows.Controls.Events.OwnerDrawEventArgs e )
{
// 如果事件委托的调用列表不为空且长度大于0,则引发事件
if ( DrawCaption != null && DrawCaption.GetInvocationList ( ).Length > 0 )
{
DrawCaption ( this , e );
}
}
/// <summary>
/// 当OwnerDraw设置为true且绘制控件的面板标题栏时发生
/// </summary>
public event DrawItemEventHandler DrawItemBar;
/// <summary>
/// 引发控件DrawItemBar事件
/// </summary>
protected virtual void OnDrawItemBar ( DrawItemEventArgs e )
{
// 如果事件委托的调用列表不为空且长度大于0,则引发事件
if ( DrawItemBar != null && DrawItemBar.GetInvocationList ( ).Length > 0 )
{
DrawItemBar ( this , e );
}
}
#endregion
#region 隐藏的属性
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new Color BackColor
{
get { return base.BackColor; }
set { base.BackColor = value; }
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override Image BackgroundImage { get { return base.BackgroundImage; } set { base.BackgroundImage = value; } }
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override ImageLayout BackgroundImageLayout { get { return base.BackgroundImageLayout; } set { base.BackgroundImageLayout = value; } }
#endregion
#region 隐藏的事件
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler BackColorChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnBackColorChanged ( EventArgs e )
{
if ( BackColorChanged != null && BackColorChanged.GetInvocationList ( ).Length > 0 )
{
BackColorChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler BackgroundImageChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnBackgroundImageChanged ( EventArgs e )
{
if ( BackgroundImageChanged != null && BackgroundImageChanged.GetInvocationList ( ).Length > 0 )
{
BackgroundImageChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler BackgroundImageLayoutChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnBackgroundImageLayoutChanged ( EventArgs e )
{
if ( BackgroundImageLayoutChanged != null && BackgroundImageLayoutChanged.GetInvocationList ( ).Length > 0 )
{
BackgroundImageLayoutChanged ( this , e );
}
}
#endregion
/// <summary>
/// 构造函数,构造类型新实例
/// </summary>
public SlidingGroup ( )
{
InitializeComponent ( );
this.SetStyle ( ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint , true );
this.Size = new Size ( 100 , 250 );
m_Panels = new CollectionBase<SlidingPanel> ( this.Controls );
m_Panels.Inserted += new CollectionBase<SlidingPanel>.ItemEventHandler ( m_Panels_Inserted );
}
protected Rectangle getCaptionRect ( )
{
if ( !ShowCaption ) return Rectangle.Empty;
Font fntCaption=SystemFonts.CaptionFont;
int width=2 * fntCaption.Height - ( int ) fntCaption.Size;
if ( Orientation == Orientation.Horizontal )
{
return new Rectangle ( BORDERWIDTH , BORDERWIDTH , width , this.ClientRectangle.Height - 2 * BORDERWIDTH );
}
else
{
return new Rectangle ( BORDERWIDTH , BORDERWIDTH , this.ClientRectangle.Width - 2 * BORDERWIDTH , width );
}
}
private Size getPanelSize ( )
{
Rectangle rect=getPanelBarRect ( SelectedIndex );
Font fntCaption=SystemFonts.CaptionFont;
int width=ShowCaption?2 * fntCaption.Height - (int)fntCaption.Size:0;
if ( rect == Rectangle.Empty ) return new Size ( this.Width - 2 * BORDERWIDTH , this.Height - 2 * BORDERWIDTH );
if ( Orientation == Orientation.Horizontal )
{
return new Size ( this.Width - 2 * BORDERWIDTH - Panels.Count * PanelBarHeight-width , this.Height - 2 * BORDERWIDTH );
}
else
{
return new Size ( this.Width - 2 * BORDERWIDTH , this.Height - 2 * BORDERWIDTH - Panels.Count * PanelBarHeight -width );
}
}
private Point getPanelLocation ( )
{
Rectangle rect=getPanelBarRect ( SelectedIndex );
if ( rect == Rectangle.Empty ) return new Point ( BORDERWIDTH , BORDERWIDTH );
if ( Orientation == Orientation.Horizontal )
{
return new Point ( rect.Right , BORDERWIDTH );
}
else
{
return new Point ( BORDERWIDTH , rect.Bottom );
}
}
public Rectangle getPanelBarRect ( int index )
{
if ( index < 0 || index >= Panels.Count ) return Rectangle.Empty;
int x=BORDERWIDTH ,y=BORDERWIDTH;
int w=0;
int h=0;
Font fntCaption=SystemFonts.CaptionFont;
int width=ShowCaption ? 2 * fntCaption.Height - (int)fntCaption.Size : 0;
if ( index <= SelectedIndex )
{
if ( Orientation == Orientation.Horizontal )
{
x += index * PanelBarHeight+width;
w = PanelBarHeight;
h = this.Height - 2 * BORDERWIDTH;
}
else
{
y += index * PanelBarHeight+width;
h = PanelBarHeight;
w = this.Width - 2 * BORDERWIDTH;
}
}
else
{
if ( Orientation == Orientation.Horizontal )
{
x = this.ClientRectangle.Right - BORDERWIDTH - ( Panels.Count - index ) * PanelBarHeight;
w = PanelBarHeight;
h = this.Height - 2 * BORDERWIDTH;
}
else
{
y = this.ClientRectangle.Bottom - BORDERWIDTH - ( Panels.Count - index ) * PanelBarHeight;
h = PanelBarHeight;
w = this.Width - 2 * BORDERWIDTH;
}
}
return new Rectangle ( x , y , w , h );
}
public Rectangle getPanelBarRect ( SlidingPanel pnl )
{
int index=Panels.IndexOf ( pnl );
if ( index < 0 ) throw new ApplicationException ( "指定面板不是控件集合中的成员" );
return getPanelBarRect ( index );
}
protected override void OnControlAdded ( ControlEventArgs e )
{
if ( !( e.Control is SlidingPanel ) ) throw new Exception ( "SlidingGroup控件只能接收SlidingPanel类型的控件为其子控件" );
base.OnControlAdded ( e );
this.Refresh ( );
}
protected override void OnControlRemoved ( ControlEventArgs e )
{
if ( e.Control == SelectedPanel&& SelectedIndex >= Panels.Count - 1 )
{
SelectedIndex--;
}
base.OnControlRemoved ( e );
TypeDescriptor.Refresh ( this );
this.Refresh ( );
}
protected int PanelBarHeight
{
get
{
return 2 * this.Font.Height - ( int ) this.Font.Size;
}
}
void m_Panels_Inserted ( object sender , CollectionBase<SlidingPanel>.ItemEventArgs e )
{
if (SelectedPanel==null )
{
SelectedPanel = e.Data;
}
if ( SelectedPanel== e.Data )
{
e.Data.Dock = DockStyle.Fill;
}
}
private SlidingPanel spHot=null;
protected override void OnMouseMove ( MouseEventArgs e )
{
base.OnMouseMove ( e );
SlidingPanel sp=getPanelAt(e.Location);
if ( sp!=spHot )
{
if(spHot!=null)this.Invalidate(getPanelBarRect(spHot));
spHot = sp;
if ( spHot != null ) this.Invalidate ( getPanelBarRect ( spHot ) );
}
}
protected override void OnMouseLeave ( EventArgs e )
{
base.OnMouseLeave ( e );
if ( spHot != null ) this.Invalidate ( getPanelBarRect ( spHot ) );
spHot = null;
}
protected override void OnPaint ( PaintEventArgs e )
{
StringFormat sf=new StringFormat ( StringFormatFlags.NoClip | StringFormatFlags.NoWrap );
sf.LineAlignment = StringAlignment.Center ;
sf.Trimming = StringTrimming.EllipsisCharacter ;
switch ( TextAlign )
{
case HorizontalAlignment.Center:
sf.Alignment = StringAlignment.Center;
break;
case HorizontalAlignment.Right:
sf.Alignment = StringAlignment.Far;
break;
}
if ( this.RightToLeft == RightToLeft.Yes ) sf.FormatFlags = sf.FormatFlags | StringFormatFlags.DirectionRightToLeft;
if ( this.Orientation == Orientation.Horizontal ) sf.FormatFlags = sf.FormatFlags | StringFormatFlags.DirectionVertical;
if(UseVisualBorder )e.Graphics.DrawBorder ( this.ClientRectangle , Etonesoft.Drawing.BorderStyle.Visual );
if ( ShowCaption )
{
Rectangle rectCaption=getCaptionRect ( );
if ( OwnerDraw )
{
OnDrawCaption ( new Etonesoft.Windows.Controls.Events.OwnerDrawEventArgs ( e.Graphics , SystemFonts.CaptionFont , rectCaption , SystemColors.ActiveCaptionText , SystemColors.ActiveCaption ) );
}
else
{
LinearGradientBrush bsh = new LinearGradientBrush ( rectCaption , SystemColors.GradientActiveCaption , SystemColors.ActiveCaption , this.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical );
e.Graphics.FillRectangle ( bsh , rectCaption );
e.Graphics.DrawString ( this.Text , SystemFonts.CaptionFont , SystemBrushes.ActiveCaptionText , rectCaption , sf );
bsh.Dispose ( );
}
}
for ( int i = 0 ; i < Panels.Count ; i++ )
{
Rectangle rect=getPanelBarRect ( i );
Rectangle txtRect=getTextRect ( i );
Rectangle imgRect=getImageRect(i);
Image img=getImage(i);
LinearGradientBrush bsh = new LinearGradientBrush ( rect , SystemColors.ControlLight , SystemColors.ControlDark , this.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical );
if ( OwnerDraw )
{
OnDrawItemBar ( new DrawItemEventArgs ( e.Graphics , this.Font , rect , i , DrawItemState.Default ) );
}
else
{
if ( rect.Contains(this.PointToClient(Control.MousePosition) ))
{
if ( Control.MouseButtons == MouseButtons.Left )
{
bsh = new LinearGradientBrush ( rect , Color.CornflowerBlue , Color.AliceBlue , this.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical );
}
else
{
bsh = new LinearGradientBrush ( rect , Color.AliceBlue , Color.CornflowerBlue , this.Orientation == Orientation.Horizontal ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical );
}
}
e.Graphics.FillRectangle ( bsh , rect );
if ( img != null )
{
e.Graphics.DrawImage ( img , imgRect );
}
e.Graphics.DrawString ( Panels [ i ].Text , this.Font , new SolidBrush(this.ForeColor), txtRect , sf );
bsh.Dispose ( );
}
}
sf.Dispose ( );
}
private Image getImage (int index )
{
if ( ImageList != null && ImageList.Images.Count > 0 )
{
if ( Panels [ index ].ImageIndex >= 0 && Panels [ index ].ImageIndex < ImageList.Images.Count )
{
return ImageList.Images [ Panels [ index ].ImageIndex ];
}
else if ( ImageList.Images.ContainsKey ( Panels [ index ].ImageKey ) )
{
return ImageList.Images [ Panels [ index ].ImageKey ];
}
else
{
return null;
}
}
return null;
}
private Rectangle getImageRect ( int index )
{
Rectangle panelbar=getPanelBarRect ( index );
if ( ImageList != null && ImageList.Images.Count > 0 )
{
if ( ( Panels [ index ].ImageIndex >= 0 && Panels [ index ].ImageIndex < ImageList.Images.Count ) ||
( ImageList.Images.ContainsKey ( Panels [ index ].ImageKey ) ) )
{
int size=Orientation== Orientation.Horizontal ? panelbar.Width:panelbar.Height ;
Rectangle rect= new Rectangle ( panelbar.Location , new Size ( size , size ) );
if ( this.RightToLeft == RightToLeft.Yes ^ this.TextAlign == HorizontalAlignment.Right )
{
if ( Orientation== Orientation.Horizontal )
{
rect.Offset ( 0 , panelbar.Height - panelbar.Width );
}
else
{
rect.Offset ( panelbar.Width - panelbar.Height , 0 );
}
}
rect.Inflate(-2,-2);
return rect;
}
}
return Rectangle.Empty;
}
private Rectangle getTextRect ( int index)
{
Rectangle panelbar=getPanelBarRect ( index );
if ( ImageList != null && ImageList.Images.Count > 0 )
{
if ( ( Panels [ index ].ImageIndex >= 0 && Panels [ index ].ImageIndex < ImageList.Images.Count ) ||
( ImageList.Images.ContainsKey ( Panels [ index ].ImageKey ) ) )
{
return Orientation == Orientation.Horizontal ?
new Rectangle ( panelbar.Left ,
this.RightToLeft == RightToLeft.Yes ^ this.TextAlign == HorizontalAlignment.Right ? panelbar.Top :panelbar.Top + panelbar.Width ,
panelbar.Width ,
panelbar.Height - panelbar.Width ) :
new Rectangle ( this.RightToLeft == RightToLeft.Yes ^ this.TextAlign == HorizontalAlignment.Right? panelbar.Left :panelbar.Left + panelbar.Height ,
panelbar.Top ,
panelbar.Width - panelbar.Height ,
panelbar.Height );
}
}
return panelbar ;
}
protected override void OnMouseUp ( MouseEventArgs e )
{
base.OnMouseUp ( e );
if ( e.Button == MouseButtons.Left )
{
SlidingPanel pnl=getPanelAt ( e.Location );
if ( pnl == null ) return;
SelectedPanel = pnl;
TypeDescriptor.Refresh ( this );
if ( spHot != null ) this.Invalidate ( getPanelBarRect ( spHot ) );
}
}
protected override void OnMouseDown ( MouseEventArgs e )
{
base.OnMouseDown ( e );
if ( spHot != null ) this.Invalidate ( getPanelBarRect ( spHot ) );
}
public SlidingPanel getPanelAt ( Point point )
{
for ( int i = 0 ; i < Panels.Count ; i++ )
{
Rectangle rect=getPanelBarRect ( i );
if ( rect.Contains ( point ) ) return Panels[i];
}
return null;
}
}
[ToolboxItem(false)]
[Designer(typeof(SlidingPanelDesigner))]
public class SlidingPanel:ScrollableControl
{
[Browsable ( true )]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
RefreshBarRect ( );
}
}
#region 属性 BorderStyle 定义
/// <summary>
/// 当属性BorderStyle更改时发生
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public event EventHandler BorderStyleChanged;
/// <summary>
/// 引发控件BorderStyleChanged事件
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected virtual void OnBorderStyleChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( BorderStyleChanged != null && BorderStyleChanged.GetInvocationList ( ).Length > 0 )
{
BorderStyleChanged ( this , e );
}
}
private BorderStyle m_BorderStyle = BorderStyle.None;
/// <summary>
/// 获取或设置面板的边框样式
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[DefaultValue ( typeof ( BorderStyle ) , "None" )]
[Description ( "获取或设置面板的边框样式" )]
public BorderStyle BorderStyle
{
get
{
return m_BorderStyle;
}
set
{
if ( m_BorderStyle == value ) return;
m_BorderStyle = value;
//TODO:在下面可添加附加的操作
this.Refresh ( );
OnBorderStyleChanged ( new EventArgs ( ) );
}
}
#endregion
//protected ImageList ImageList
//{
// get
// {
// if ( this.Parent == null ) return null;
// return ( this.Parent as SlidingGroup ).ImageList;
// }
//}
#region 属性 ImageIndex 定义
/// <summary>
/// 当属性ImageIndex更改时发生
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public event EventHandler ImageIndexChanged;
/// <summary>
/// 引发控件ImageIndexChanged事件
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected virtual void OnImageIndexChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( ImageIndexChanged != null && ImageIndexChanged.GetInvocationList ( ).Length > 0 )
{
ImageIndexChanged ( this , e );
}
}
private int m_ImageIndex = -1;
/// <summary>
/// 获取或设置控件关联的图像在图像列表中的位置
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[TypeConverter ( typeof ( System.Windows.Forms.ImageIndexConverter ) )]
[Localizable ( true )]
//[Editor ( "System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" , typeof ( UITypeEditor ) )]
[Editor ( typeof ( ImageIndexEditor ) , typeof ( UITypeEditor ) )]
[DefaultValue ( -1 )]
[RefreshProperties ( RefreshProperties.Repaint )]
[Description ( "获取或设置控件关联的图像在图像列表中的位置" )]
public int ImageIndex
{
get
{
return m_ImageIndex;
}
set
{
if ( m_ImageIndex == value ) return;
if ( value >=0 ) ImageKey = "";
m_ImageIndex = value;
//TODO:在下面可添加附加的操作
RefreshBarRect ( );
OnImageIndexChanged ( new EventArgs ( ) );
}
}
#endregion
#region 属性 ImageKey 定义
/// <summary>
/// 当属性ImageKey更改时发生
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public event EventHandler ImageKeyChanged;
/// <summary>
/// 引发控件ImageKeyChanged事件
/// </summary>
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected virtual void OnImageKeyChanged ( EventArgs e )
{
//如果事件委托链不为空且长度大于0,则触发事件
if ( ImageKeyChanged != null && ImageKeyChanged.GetInvocationList ( ).Length > 0 )
{
ImageKeyChanged ( this , e );
}
}
private string m_ImageKey = "";
/// <summary>
/// 获取或设置控件关联的图像在图像列表中的键
/// </summary>
[Browsable ( true )]
[Category ( "自定义" )]
[TypeConverter ( typeof ( System.Windows.Forms.ImageKeyConverter ) )]
//[Editor ( "System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" , typeof ( UITypeEditor ) )]
[Editor(typeof(ImageKeyEditor ),typeof(UITypeEditor))]
[Localizable ( true )]
[DefaultValue ( "" )]
[RefreshProperties ( RefreshProperties.Repaint )]
[Description ( "获取或设置控件关联的图像在图像列表中的键" )]
public string ImageKey
{
get
{
return m_ImageKey;
}
set
{
if ( m_ImageKey == value ) return;
if ( value != "(无)"&& value != "" ) m_ImageIndex = -1;
m_ImageKey = value;
//TODO:在下面可添加附加的操作
RefreshBarRect ( );
OnImageKeyChanged ( new EventArgs ( ) );
}
}
#endregion
#region 隐藏的属性
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new bool Visible
{
get { return base.Visible; }
set { base.Visible = value; }
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override AnchorStyles Anchor
{
get
{
return base.Anchor;
}
set
{
base.Anchor = value;
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override DockStyle Dock
{
get
{
return base.Dock;
}
set
{
base.Dock = value;
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new bool Enabled { get { return base.Enabled; } set { base.Enabled = value; } }
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new Point Location { get { return base.Location; } set { base.Location = value; } }
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override Size MaximumSize
{
get
{
return base.MaximumSize;
}
set
{
base.MaximumSize = value;
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public override Size MinimumSize
{
get
{
return base.MinimumSize;
}
set
{
base.MinimumSize = value;
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new int TabIndex { get { return base.TabIndex; } set { base.TabIndex = value; } }
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new bool TabStop { get { return base.TabStop; } set { base.TabStop = value; } }
#endregion
#region 隐藏事件
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler DockChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnDockChanged ( EventArgs e )
{
if ( DockChanged != null && DockChanged.GetInvocationList ( ).Length > 0 )
{
DockChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler EnabledChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnEnabledChanged ( EventArgs e )
{
if ( EnabledChanged != null && EnabledChanged.GetInvocationList ( ).Length > 0 )
{
EnabledChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler LocationChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnLocationChanged ( EventArgs e )
{
if ( LocationChanged != null && LocationChanged.GetInvocationList ( ).Length > 0 )
{
LocationChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event KeyEventHandler KeyDown;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnKeyDown ( KeyEventArgs e )
{
if ( KeyDown != null && KeyDown.GetInvocationList ( ).Length > 0 )
{
KeyDown ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event KeyPressEventHandler KeyPress;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnKeyPress ( KeyPressEventArgs e )
{
if ( KeyPress != null && KeyPress.GetInvocationList ( ).Length > 0 )
{
KeyPress ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event KeyEventHandler KeyUp;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnKeyUp ( KeyEventArgs e )
{
if ( KeyUp != null && KeyUp.GetInvocationList ( ).Length > 0 )
{
KeyUp ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler TabStopChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnTabStopChanged ( EventArgs e )
{
if ( TabStopChanged != null && TabStopChanged.GetInvocationList ( ).Length > 0 )
{
TabStopChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler TabIndexChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnTabIndexChanged ( EventArgs e )
{
if ( TabIndexChanged != null && TabIndexChanged.GetInvocationList ( ).Length > 0 )
{
TabIndexChanged ( this , e );
}
}
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
public new event EventHandler VisibleChanged;
[Browsable ( false )]
[EditorBrowsable ( EditorBrowsableState.Never )]
protected override void OnVisibleChanged ( EventArgs e )
{
if ( VisibleChanged != null && VisibleChanged.GetInvocationList ( ).Length > 0 )
{
VisibleChanged ( this , e );
}
}
#endregion
public SlidingPanel ( ):base(){}
public SlidingPanel ( string text):base()
{
base.Text = text;
}
private void RefreshBarRect ( )
{
if ( this.Parent != null )
{
SlidingGroup sg=this.Parent as SlidingGroup;
sg.Invalidate ( sg.getPanelBarRect ( this ) );
}
}
protected override void OnPaint ( PaintEventArgs e )
{
Graphics g=e.Graphics;
Rectangle rect=this.ClientRectangle;
//rect.Inflate ( -2 , -2 );
switch ( BorderStyle )
{
case BorderStyle.Fixed3D:
g.DrawBorder ( rect , Etonesoft.Drawing.BorderStyle.Sunken );
break;
case BorderStyle.FixedSingle:
g.DrawBorder ( rect , Color.Black , ButtonBorderStyle.Solid );
break;
default:
break;
}
}
}
#region 扩展设计时支持
// 虽然SlidingGroups继承自Control,但此处仍选择ScrollableControlDesigner类型的设计器,
// 原因是如果选择ControlDesigner,由于要支持设计时通过单击控件指定区域进行当前选择面板的修改,在
// 进行命中测试时,鼠标指针会有闪烁,为避免该情况,所以选择前者。
class SlidingGroupsDesigner : Etonesoft.Windows.Controls.Design.ScrollableControlDesigner<SlidingGroup>
{
public override void Initialize ( IComponent component )
{
base.Initialize ( component );
base.ActionList = new SlidingGroupActionList ( this.Component );
}
// 之所以重写下面的方法,是因为当按住鼠标左键不放时,容器控件的设计器会支持套索选择,
// 此处不需要,所以重写以屏蔽该效果
protected override void OnMouseDragMove ( int x , int y )
{
//base.OnMouseDragMove ( x , y );
}
protected override bool GetHitTest ( Point pt )
{
SlidingGroup cg=this.Control as SlidingGroup;
return this.ComponentSelected && cg.getPanelAt ( cg.PointToClient ( pt ) ) != null;
}
public override bool CanParent ( Control control )
{
return control is SlidingPanel;
}
public override bool CanParent ( ControlDesigner controlDesigner )
{
return controlDesigner is SlidingPanelDesigner;
}
}
[Serializable]
class SlidingGroupToolItem : Etonesoft.Drawing.Design.ToolboxItemBase
{
public SlidingGroupToolItem ( ):base(){}
public SlidingGroupToolItem ( Type type):base(type){}
SlidingGroupToolItem (System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context)
{
Deserialize ( info , context );
}
protected override IComponent [] CreateComponentsCore ( IDesignerHost host , System.Collections.IDictionary defaultValues )
{
IComponent[] comps= base.CreateComponentsCore ( host , defaultValues );
ToolboxItem ti=new ToolboxItem ( typeof ( SlidingPanel ) );
SlidingGroup sg=comps [ 0 ] as SlidingGroup;
for ( int i = 0 ; i < 3 ; i++ )
{
SlidingPanel pnl=ti.CreateComponents ( host )[0] as SlidingPanel ;// host.CreateComponent ( typeof ( SlidingPanel ) ) as SlidingPanel;
pnl.Location = Point.Empty;
pnl.Size = Size.Empty;
pnl.Dock = DockStyle.None;
sg.Panels.Add ( pnl );
}
sg.SelectedIndex =0;
return comps;
}
}
class SlidingPanelDesigner : Etonesoft.Windows.Controls.Design.ScrollableControlDesigner<SlidingPanel>
{
public override void Initialize ( IComponent component )
{
base.Initialize ( component );
this.ActionList = new SlidingPanelActionList ( this.Component );
}
public override bool CanBeParentedTo ( IDesigner parentDesigner )
{
return parentDesigner is SlidingGroupsDesigner;
}
protected override void OnMouseDragMove ( int x , int y )
{
//以下变换保证在套索选择子控件时,选择框位于该控件的客户区内
Point ptClient=this.Control.PointToClient(new Point(x,y));
Rectangle rectScreen=this.Control.RectangleToScreen ( this.Control.ClientRectangle );
if ( ptClient.X<0 )x = rectScreen.Left ;
if ( ptClient.Y < 0 ) y = rectScreen.Top ;
if ( ptClient.X > this.Control.ClientRectangle.Right ) x = rectScreen.Right;
if ( ptClient.Y > this.Control.ClientRectangle.Bottom ) y = rectScreen.Bottom;
base.OnMouseDragMove ( x , y );
}
protected override void OnMouseDragEnd ( bool cancel )
{
base.OnMouseDragEnd ( cancel );
this.Control.Refresh ( );
}
protected override void OnPaintAdornments ( PaintEventArgs pe )
{
if ( ( this.Control as SlidingPanel ).BorderStyle != BorderStyle.None ) return;
Rectangle rect=this.Control.ClientRectangle;
// rect.Inflate ( -2 , -2 );
pe.Graphics.DrawBorder ( rect , Color.Gray , ButtonBorderStyle.Dashed );
}
}
class SlidingGroupActionList : Etonesoft.Windows.Controls.Design.CommonDesignerActionList<SlidingGroup>
{
public SlidingGroupActionList ( IComponent component ) : base ( component ) { }
public bool cdt1{get{return this.Control.SelectedPanel != null;}}
public bool cdt2 { get { return this.Control.Dock == DockStyle.None && this.Control.Orientation == Orientation.Vertical; } }
public bool cdt3 { get { return this.Control.Dock == DockStyle.None && this.Control.Orientation == Orientation.Horizontal; } }
public bool cdt4 { get { return this.Control.Dock == DockStyle.None; } }
public bool cdt5 { get { return this.Control.Dock != DockStyle.None; } }
[ActionListItem("ImageList","外观")]
public ImageList ImageList { get { return this.Control.ImageList; } set { this.Control.ImageList = value; } }
[ActionListItem ( "显示标题栏" , "外观" )]
public bool ShowCaption { get { return this.Control.ShowCaption; } set { this.Control.ShowCaption = value; } }
[ActionListItem ( "文本对齐" , "外观" )]
public HorizontalAlignment TextAlign { get { return this.Control.TextAlign; } set { this.Control.TextAlign = value; } }
[ActionListItem ( "添加面板" , "行为" )]
public void AddPanel ( )
{
IDesignerHost dh=this.Control.Site.GetService ( typeof ( IDesignerHost ) ) as IDesignerHost;
ToolboxItem ti=new ToolboxItem ( typeof ( SlidingPanel ) );
if ( dh!=null )
{
IComponent[] comps=ti.CreateComponents ( dh ); //dh.CreateComponent ( typeof ( SlidingPanel ) );
if ( comps != null ) this.Control.Panels.Add ( comps[0] as SlidingPanel );
}
if ( this.Control.Panels.Count == 1 ) this.designerActionUISvc.Refresh ( this.Control );
}
[ActionListItem ( "移除面板" , "行为" )]
[ActionListDesplayCondition ( "cdt1" )]
public void RemoveCurrPanel ( )
{
SlidingPanel spCurr=this.Control.SelectedPanel;
if ( spCurr != null )
{
IDesignerHost dh=this.Control.Site.GetService ( typeof ( IDesignerHost ) ) as IDesignerHost;
if ( dh != null )dh.DestroyComponent ( spCurr );
}
if ( this.Control.SelectedPanel != null )
{
this.Control.SelectedPanel.Dock = DockStyle.Fill;
this.SelectionSrv.SetSelectedComponents(new IComponent[]{this.Control.SelectedPanel});
}
else
{
this.SelectionSrv.SetSelectedComponents ( new IComponent [] { this.Control } );
}
if ( this.Control.Panels.Count <= 0 ) this.designerActionUISvc.Refresh ( this.Control );
}
[ActionListItem ( "向左停靠" , "常规" )]
[ActionListDesplayCondition ( "cdt2" )]
public void DockToLeft ( )
{ this.Control.Dock = DockStyle.Left; this.designerActionUISvc.Refresh ( this.Control ); }
[ActionListDesplayCondition ( "cdt3" )]
[ActionListItem ( "向上停靠" , "常规" )]
public void DockToTop ( )
{ this.Control.Dock = DockStyle.Top; this.designerActionUISvc.Refresh ( this.Control ); }
[ActionListItem ( "向右停靠" , "常规" )]
[ActionListDesplayCondition ( "cdt2" )]
public void DockToRight ( )
{ this.Control.Dock = DockStyle.Right; this.designerActionUISvc.Refresh ( this.Control ); }
[ActionListItem ( "向下停靠" , "常规" )]
[ActionListDesplayCondition ( "cdt3" )]
public void DockToBottom ( )
{ this.Control.Dock = DockStyle.Bottom; this.designerActionUISvc.Refresh ( this.Control ); }
[ActionListItem ( "填充停靠" , "常规" )]
[ActionListDesplayCondition ( "cdt4" )]
public void DockToAll ( )
{ this.Control.Dock = DockStyle.Fill; this.designerActionUISvc.Refresh ( this.Control ); }
[ActionListItem ( "取消停靠" , "常规" )]
[ActionListDesplayCondition ( "cdt5" )]
public void CancelDock ( )
{ this.Control.Dock = DockStyle.None; this.designerActionUISvc.Refresh ( this.Control ); }
}
class SlidingPanelActionList :Etonesoft.Windows.Controls.Design.CommonDesignerActionList<SlidingPanel>
{
public SlidingPanelActionList ( IComponent component ) : base ( component ) { }
[ActionListItem ( "边框样式" ,"外观")]
public BorderStyle BorderStyle
{
get { return this.Control.BorderStyle; }
set { this.Control.BorderStyle = value; }
}
[ActionListItem ( "ImageIndex" , "外观" )]
[TypeConverter ( typeof ( System.Windows.Forms.ImageIndexConverter ) )]
[Editor ( typeof ( Etonesoft.Windows.Controls.Design.ImageIndexEditor ) , typeof ( System.Drawing.Design.UITypeEditor ) )]
public int ImageIndex
{
get { return this.Control.ImageIndex; }
set { this.Control.ImageIndex = value; this.designerActionUISvc.Refresh ( this.Component ); }
}
[ActionListItem ( "ImageKey" , "外观" )]
[TypeConverter ( typeof ( System.Windows.Forms.ImageKeyConverter ) )]
[Editor ( typeof ( Etonesoft.Windows.Controls.Design.ImageKeyEditor ) , typeof ( System.Drawing.Design.UITypeEditor ) )]
public string ImageKey
{
get { return this.Control.ImageKey; }
set { this.Control.ImageKey = value; this.designerActionUISvc.Refresh ( this.Component ); }
}
}
#endregion
}