52 lines
1.8 KiB
C#
52 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Drawing;
|
|
|
|
namespace DevComponents.DotNetBar.Layout
|
|
{
|
|
public class PaintContext : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the PaintContext class.
|
|
/// </summary>
|
|
/// <param name="control"></param>
|
|
/// <param name="graphics"></param>
|
|
public PaintContext(LayoutControl control, Graphics graphics, System.Drawing.Text.HotkeyPrefix hotkeyPrefix)
|
|
{
|
|
Control = control;
|
|
Graphics = graphics;
|
|
DefaultFont = control.LabelFont ?? control.Font;
|
|
HotkeyPrefix = hotkeyPrefix;
|
|
if (control.FocusStyle != null && control.FocusStyle.IsPainted)
|
|
this.FocusStyle = control.FocusStyle;
|
|
if (control.LabelTextColor.IsEmpty)
|
|
LabelTextColor = control.ForeColor;
|
|
else
|
|
LabelTextColor = control.LabelTextColor;
|
|
LabelTextBrush = new SolidBrush(LabelTextColor);
|
|
TextAlignment = control.LabelTextAlignment;
|
|
}
|
|
public LayoutControl Control = null;
|
|
public Graphics Graphics = null;
|
|
public Font DefaultFont = null;
|
|
public System.Drawing.Text.HotkeyPrefix HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show;
|
|
public SimpleStyle FocusStyle = null;
|
|
public Color LabelTextColor = Color.Empty;
|
|
public Brush LabelTextBrush = null;
|
|
public eTextAlignment TextAlignment = eTextAlignment.Default;
|
|
#region IDisposable Members
|
|
|
|
public void Dispose()
|
|
{
|
|
if (LabelTextBrush != null)
|
|
{
|
|
LabelTextBrush.Dispose();
|
|
LabelTextBrush = null;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|