?? axstatusbarpanel.cs
字號:
// DINAMIC XML Editor
//
// Copyright (c) 2002-2003 Dusan Hlavaty
// mailto: duddo@atlas.cz
//
// This software is licensed under the terms of
// GNU General Public license
//
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
namespace XML_editor.MyComponents
{
/// <summary>
/// Reprezentuje StatusPanel - pouziva sa v <see cref="AxStatusBar"/> namiesto
/// povodneho <see cref="StatusBarPanel"/>
/// </summary>
public class AxStatusBarPanel : StatusBarPanel
{
private StringFormat sFormat = new StringFormat();
// -------------------------------------------------------------------------
/// <summary>
/// Inicializuje instanciu <see cref="AxStatusBarPanel"/>
/// </summary>
public AxStatusBarPanel()
{
Style = StatusBarPanelStyle.OwnerDraw;
BorderStyle = StatusBarPanelBorderStyle.None;
sFormat.LineAlignment = StringAlignment.Center;
}
// -------------------------------------------------------------------------
/// <summary>
/// Vykresli okraj okolo tohoto <c>StatusBarPanela</c>
/// </summary>
/// <param name="drawEventArgs"></param>
protected virtual void DrawBorder(StatusBarDrawItemEventArgs drawEventArgs)
{
drawEventArgs.Graphics.DrawRectangle(SystemPens.ControlDark,
new Rectangle(drawEventArgs.Bounds.X,
drawEventArgs.Bounds.Y,
drawEventArgs.Bounds.Width - 1,
drawEventArgs.Bounds.Height - 1));
}
// -------------------------------------------------------------------------
/// <summary>
/// Vykresli samotny <c>StatusBarPanel</c>
/// </summary>
/// <param name="drawEventArgs"></param>
public virtual void DrawPanel(StatusBarDrawItemEventArgs drawEventArgs)
{
Graphics g = drawEventArgs.Graphics;
switch (Alignment)
{
case HorizontalAlignment.Left:
sFormat.Alignment = StringAlignment.Near;
break;
case HorizontalAlignment.Center:
sFormat.Alignment = StringAlignment.Center;
break;
case HorizontalAlignment.Right:
sFormat.Alignment = StringAlignment.Far;
break;
}
g.DrawString(Text,
drawEventArgs.Font,
SystemBrushes.ControlText,
drawEventArgs.Bounds,
sFormat);
DrawBorder(drawEventArgs);
}
// -------------------------------------------------------------------------
/// <summary>
/// Vola sa pri odstranovani panela z pamate
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
if (disposing)
{
sFormat.Dispose();
}
}
} // class AxStatusBarPanel
} // namespace XML_editor.MyComponents
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -