?? hstatusbar.cs
字號:
using System;
using System.Windows.Forms;
using System.Drawing;
namespace CallCenter.BusinessInterfaces.MainForms
{
/// <summary>
/// HStatusBar 的摘要說明。
/// </summary>
public class HStatusBar:StatusBar
{
// private Color _color;
public HStatusBar()
{
//
// TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
this.BackColor=Color.Red;
}
public override System.Drawing.Color BackColor
{
get
{
return Color.Red;//base.BackColor;
}
set
{
base.BackColor = value;
}
}
public Color setColor
{
get
{
return BackColor;
}
set
{
BackColor=value;
}
}
private Color _panelcolor1=Color.FromArgb(195,218,249);//panel顏色1
public Color panelcolor1
{
get
{
return _panelcolor1;
}
set
{
_panelcolor1=value;
}
}
private Color _panelcolor2=Color.FromArgb(158,190,245);//panel顏色2
public Color panelcolor2
{
get
{
return _panelcolor2;
}
set
{
_panelcolor2=value;
}
}
private Color _textcolor=Color.Black;//文本顏色
public Color textcolor
{
get
{
return _textcolor;
}
set
{
_textcolor=value;
}
}
private Color _bordercolor=Color.Blue;//邊框顏色
public Color bordercolor
{
get
{
return _bordercolor;
}
set
{
_bordercolor=value;
}
}
protected override void OnDrawItem(StatusBarDrawItemEventArgs sbdevent)
{
base.OnDrawItem (sbdevent);
// Create a StringFormat object to align text in the panel.
StringFormat sf = new StringFormat();
// Format the String of the StatusBarPanel to be centered.
sf.LineAlignment = StringAlignment.Center;
sf.FormatFlags = StringFormatFlags.NoWrap;
StatusBarPanel panel = (StatusBarPanel)sbdevent.Panel;
if( panel.Alignment == HorizontalAlignment.Left )
sf.Alignment = StringAlignment.Center;
else if( panel.Alignment == HorizontalAlignment.Left )
sf.Alignment = StringAlignment.Near;
else
sf.Alignment = StringAlignment.Far;
Rectangle rect = sbdevent.Bounds;
// rect.Width -= 1;
// rect.Height -= 2;
System.Drawing.Drawing2D.LinearGradientBrush bBackground
= new System.Drawing.Drawing2D.LinearGradientBrush(rect, panelcolor1, panelcolor2, 10);
Graphics g = sbdevent.Graphics;
g.FillRectangle(bBackground, rect);
g.DrawRectangle(new Pen(bordercolor),rect);
g.DrawString(panel.Text,this.Font,new SolidBrush(textcolor),sbdevent.Bounds,sf);
bBackground.Dispose();
}
protected override void OnPaint(PaintEventArgs e)
{
// paint all the panels
int xStart = 0;
OnDrawItem(new StatusBarDrawItemEventArgs(e.Graphics,Font,
new Rectangle(xStart,2,this.Panels[0].Width-2,Height-1),1,DrawItemState.Default,this.Panels[0]));
xStart += this.Panels[1].Width;
OnDrawItem(new StatusBarDrawItemEventArgs(e.Graphics,Font,
new Rectangle(xStart,2,this.Panels[1].Width-2,Height-1),1,DrawItemState.Default,this.Panels[1]));
xStart += this.Panels[2].Width;
OnDrawItem(new StatusBarDrawItemEventArgs(e.Graphics,Font,
new Rectangle(xStart,2,this.Panels[2].Width-2,Height-1),1,DrawItemState.Default,this.Panels[2]));
xStart += this.Panels[3].Width;
OnDrawItem(new StatusBarDrawItemEventArgs(e.Graphics,Font,
new Rectangle(xStart,2,this.Panels[3].Width,Height-1),1,DrawItemState.Default,this.Panels[3]));
// draw the resize grip
if( this.SizingGrip == true )
ControlPaint.DrawSizeGrip(e.Graphics,SystemColors.Control,new Rectangle(this.Width-17,this.Height - 17,
16,16));
base.OnPaint (e);
}
protected override void OnResize(EventArgs e)
{
// test if the size is near maximuized, disable the sizing grip
if( SystemInformation.VirtualScreen.Width <= Width )
this.SizingGrip = false;
else
this.SizingGrip = true;
base.OnResize (e);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -