本文整理汇总了C#中Canvas.DrawFillRect方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawFillRect方法的具体用法?C# Canvas.DrawFillRect怎么用?C# Canvas.DrawFillRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.DrawFillRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRender
public override void OnRender(Canvas c)
{
c.DrawFillRect(_client_area, _background_color_material);
_font.DrawText(null, _text, ClientArea, DrawTextFormat.VerticalCenter | DrawTextFormat.Center, ForegroundColor);
c.DrawRect(_client_area, BorderColor);
}
示例2: OnRender
public override void OnRender(Canvas c)
{
SetViewportDimensions(_panel_area);
StartViewport(c);
lock(this) {
if (MenuOptions != null)
{
c.DrawFillRect(_client_area, _background_color_material);
if (MenuOptions.Length > 0)
{
int height = 0;
int width = 0;
if ((_layout == PanelLayout.Vertical) || (_layout == PanelLayout.Horizontal))
{
height = _client_area.Height / MenuOptions.Length;
width = _client_area.Width / MenuOptions.Length;
}
for (int i = 0; i < MenuOptions.Length; i++)
{
switch (_layout)
{
case PanelLayout.Vertical:
MenuLocations[i].X = StartX;
MenuLocations[i].Y = StartY + (i * height);
MenuLocations[i].Width = _client_area.Width;
MenuLocations[i].Height = height - 2;
break;
case PanelLayout.Horizontal:
MenuLocations[i].X = StartX + (i * width);
MenuLocations[i].Y = StartY;
MenuLocations[i].Width = width - 2;
MenuLocations[i].Height = _client_area.Height;
break;
case PanelLayout.HorizontalFree:
MenuLocations[i].X = StartX + width;
MenuLocations[i].Y = StartY;
MenuLocations[i].Height = _client_area.Height;
width += MenuLocations[i].Width;
break;
case PanelLayout.VerticalFree:
MenuLocations[i].X = StartX;
MenuLocations[i].Y = StartY + height;
MenuLocations[i].Width = _client_area.Width;
height += MenuLocations[i].Height;
break;
default:
throw new ArgumentException("Unsupported Layout type.");
}
if (i != _selected_index)
{
_font.DrawText(null, MenuOptions[i], MenuLocations[i], DrawFormat, ForegroundColor);
}
else
{
_font.DrawText(null, MenuOptions[i], MenuLocations[i], DrawFormat, Color.Yellow);
}
}
}
}
EndViewport(c);
switch (_layout)
{
case PanelLayout.Horizontal:
goto case PanelLayout.HorizontalFree;
case PanelLayout.HorizontalFree:
if (_panel_area.Width < _menu_item_height)
{
c.DrawFillRect(_left_button_area, _button_material);
if (!HideLeftScrollBtn)
{
if ((_draw_bounding_box == BoundingBox.LEFT))
{
c.DrawFillTri(_left_arrow, _arrow_selected, DIRECTION.LEFT);
}
else
{
c.DrawFillTri(_left_arrow, _arrow_material, DIRECTION.LEFT);
}
}
c.DrawFillRect(_right_button_area, _button_material);
if (!HideRightScrollBtn)
{
if ((_draw_bounding_box == BoundingBox.RIGHT))
{
c.DrawFillTri(_right_arrow, _arrow_selected, DIRECTION.RIGHT);
}
else
{
c.DrawFillTri(_right_arrow, _arrow_material, DIRECTION.RIGHT);
}
}
}
break;
case PanelLayout.Vertical:
goto case PanelLayout.VerticalFree;
case PanelLayout.VerticalFree:
//.........这里部分代码省略.........
示例3: OnRender
public override void OnRender(Canvas c)
{
if ((_font != null) && !Hide)
{
c.DrawFillRect(_client_area, _background_material);
_slider_area.Width = _client_area.Width - 18;
_slider_area.Height = Height;
_txt_area = _font.MeasureString(null, _percent, DrawTextFormat.None, ForegroundColor);
_font.DrawText(null, _percent, _client_area, DrawTextFormat.Center | DrawTextFormat.Top, ForegroundColor);
_left_arrow.X = _client_area.Left;
_left_arrow.Y = _client_area.Y + _txt_area.Height + 1;
_left_arrow.Width = 8;
_left_arrow.Height = _slider_area.Height;
c.DrawFillTri(_left_arrow, _arrow_material, DIRECTION.LEFT);
_slider_area.X = _left_arrow.Right + 1;
_slider_area.Y = _client_area.Y + _txt_area.Height + 1;
c.DrawProgressBar(_slider_area, _slider_background_material, _slider_foreground_material, _slider_position);
_right_arrow.X = _slider_area.Right + 1;
_right_arrow.Y = _client_area.Y + _txt_area.Height + 1;
_right_arrow.Width = 8;
_right_arrow.Height = _slider_area.Height;
c.DrawFillTri(_right_arrow, _arrow_material, DIRECTION.RIGHT);
c.DrawRect(_client_area, BorderColor);
}
}
示例4: OnRender
public override void OnRender(Canvas c)
{
c.DrawFillRect(_client_area, BackgroundMaterial);
_font.DrawText(null, _text, ClientArea, DrawTextFormat.VerticalCenter | DrawTextFormat.Center, ForegroundColor);
if (Selected)
{
DrawBoundingBox(c);
}
else
{
c.DrawRect(_client_area, BorderColor);
}
}