本文整理汇总了C#中IPalette.GetDropDownButtonImage方法的典型用法代码示例。如果您正苦于以下问题:C# IPalette.GetDropDownButtonImage方法的具体用法?C# IPalette.GetDropDownButtonImage怎么用?C# IPalette.GetDropDownButtonImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPalette
的用法示例。
在下文中一共展示了IPalette.GetDropDownButtonImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawDropDownButton
/// <summary>
/// Perform drawing of a drop down button.
/// </summary>
/// <param name="context">Render context.</param>
/// <param name="displayRect">Display area available for drawing.</param>
/// <param name="palette">Palette for sourcing display values.</param>
/// <param name="state">State for which image size is needed.</param>
/// <param name="orientation">How to orientate the image.</param>
public override void DrawDropDownButton(RenderContext context,
Rectangle displayRect,
IPalette palette,
PaletteState state,
VisualOrientation orientation)
{
Debug.Assert(context != null);
Debug.Assert(palette != null);
// Validate parameter references
if (context == null) throw new ArgumentNullException("context");
if (palette == null) throw new ArgumentNullException("palette");
// Grab an image appropriate to the state
Image drawImage = palette.GetDropDownButtonImage(state);
if (drawImage != null)
DrawImageHelper(context, drawImage, Color.Empty,
displayRect, orientation, PaletteImageEffect.Normal,
Color.Empty, Color.Empty);
}
示例2: GetDropDownButtonPreferredSize
/// <summary>
/// Calculate the requested display size for the drop down button.
/// </summary>
/// <param name="context">Render context.</param>
/// <param name="palette">Palette for sourcing display values.</param>
/// <param name="state">State for which image size is needed.</param>
/// <param name="orientation">How to orientate the image.</param>
public override Size GetDropDownButtonPreferredSize(ViewLayoutContext context,
IPalette palette,
PaletteState state,
VisualOrientation orientation)
{
// Grab an image appropriate to the state
Image drawImage = palette.GetDropDownButtonImage(state);
// Get the image defined size
Size imageSize = Size.Empty;
if (drawImage != null)
imageSize = drawImage.Size;
// Alter size for different orientations
if ((orientation == VisualOrientation.Left) ||
(orientation == VisualOrientation.Right))
{
// Switch dimensions to reflect rotation of 90 or 270 degrees
imageSize = new Size(imageSize.Height, imageSize.Width);
}
return imageSize;
}