本文整理汇总了C#中DevComponents.DotNetBar.ButtonItem.GetEnabled方法的典型用法代码示例。如果您正苦于以下问题:C# ButtonItem.GetEnabled方法的具体用法?C# ButtonItem.GetEnabled怎么用?C# ButtonItem.GetEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevComponents.DotNetBar.ButtonItem
的用法示例。
在下文中一共展示了ButtonItem.GetEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTextColor
protected virtual Color GetTextColor(ButtonItem button, ItemPaintArgs pa, Office2007ButtonItemColorTable buttonColorTable, bool isExpandPart)
{
Color textColor = Color.Empty;
bool isMouseOver = button.IsMouseOver;
if (isMouseOver)
{
if (isExpandPart)
{
if (!button.IsMouseOverExpand)
isMouseOver = false;
}
else if (!button.IsMouseOverExpand && button.SplitButton)
isMouseOver = false;
}
if (isMouseOver)
{
if (!button.HotForeColor.IsEmpty)
textColor = button.HotForeColor;
}
else if (!button.ForeColor.IsEmpty)
textColor = button.ForeColor;
if (textColor.IsEmpty)
{
if (buttonColorTable != null)
{
if (!button.GetEnabled(pa.ContainerControl))
{
if (buttonColorTable.Disabled != null)
textColor = buttonColorTable.Disabled.Text;
}
else if (button.IsMouseDown)
textColor = buttonColorTable.Pressed.Text;
else if (isMouseOver && !(button.EffectiveStyle == eDotNetBarStyle.Metro && button.Expanded))
textColor = buttonColorTable.MouseOver.Text;
else if (button.Expanded)
textColor = buttonColorTable.Expanded.Text;
else if (button.Checked && !IsOnMenu(button, pa))
textColor = buttonColorTable.Checked.Text;
else
textColor = buttonColorTable.Default.Text;
}
}
if (textColor.IsEmpty)
return base.GetTextColor(button, pa);
return textColor;
}
示例2: PaintButton
public override void PaintButton(ButtonItem button, ItemPaintArgs pa)
{
bool isOnMenu=IsOnMenu(button, pa);
if(isOnMenu && button.Parent is ItemContainer)
isOnMenu=false;
bool bIsOnMenuBar=pa.IsOnMenuBar;
bool bThemed=button.IsThemed;
Graphics g = pa.Graphics;
Region oldClip = g.Clip as Region;
try
{
g.SetClip(button.DisplayRectangle, CombineMode.Intersect);
if (!pa.IsOnMenu && !bIsOnMenuBar && bThemed)
{
if (pa.ContainerControl is ButtonX)
ThemedButtonXPainter.PaintButton(button, pa);
else
ThemedButtonItemPainter.PaintButton(button, pa);
return;
}
Rectangle itemRect = button.DisplayRectangle;
Color textColor = GetTextColor(button, pa);
CompositeImage image = button.GetImage(textColor);
Rectangle imageRect = GetImageRectangle(button, pa, image);
PaintButtonBackground(button, pa, image);
Rectangle customizeCheckRect = GetCustomizeMenuCheckRectangle(button, pa);
Rectangle checkRect = GetCheckRectangle(button, pa, image);
Rectangle mouseOverRect = GetMouseOverRectangle(button, pa, image);
bool mouseOver = button.IsMouseOver;
if (button.Expanded && !isOnMenu)
mouseOver = false;
if (isOnMenu && button.Expanded && pa.ContainerControl != null && pa.ContainerControl.Parent != null)
{
if (!pa.ContainerControl.Parent.Bounds.Contains(System.Windows.Forms.Control.MousePosition))
mouseOver = true;
}
if (button.HotTrackingStyle != eHotTrackingStyle.None)
{
if (mouseOver || button.IsMouseDown && !button.DesignMode)
PaintButtonMouseOver(button, pa, image, mouseOverRect);
}
if (isOnMenu && button.IsOnCustomizeMenu && button.Visible && !button.SystemItem)
PaintCustomizeCheck(button, pa, customizeCheckRect);
if (button.Checked && !button.IsOnCustomizeMenu && (button.GetEnabled(pa.ContainerControl) || isOnMenu))
PaintButtonCheck(button, pa, image, checkRect);
if ((image != null || !string.IsNullOrEmpty(button.Symbol)) && button.ButtonStyle != eButtonStyle.TextOnlyAlways)
PaintButtonImage(button, pa, image, imageRect);
if (!(button is ApplicationButton) || button.EffectiveStyle == eDotNetBarStyle.Office2010 || button.EffectiveStyle == eDotNetBarStyle.Metro)
PaintButtonText(button, pa, textColor, image);
PaintExpandButton(button, pa);
if (button.Focused && button.DesignMode)
{
Rectangle r = itemRect;
r.Inflate(-1, -1);
DesignTime.DrawDesignTimeSelection(g, r, pa.Colors.ItemDesignTimeBorder);
}
if (image != null)
image.Dispose();
}
finally
{
if (oldClip != null)
{
g.Clip = oldClip;
oldClip.Dispose();
}
else
g.ResetClip();
}
}