本文整理汇总了C#中System.Drawing.Rectangle.ShrinkedY方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.ShrinkedY方法的具体用法?C# Rectangle.ShrinkedY怎么用?C# Rectangle.ShrinkedY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Rectangle
的用法示例。
在下文中一共展示了Rectangle.ShrinkedY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
var helper = new GraphicsHelper(e.Graphics);
var orientation = SideBarOrientation.Left;
if (SideBar != null)
{
orientation = SideBar.Orientation;
}
for (var i = 0; i < Tabs.Count; i++)
{
SideBarTab tab = Tabs[i];
Point currentPosition = Point.Empty;
Rectangle tabRect = Rectangle.Empty,
textRect = Rectangle.Empty;
switch (orientation)
{
case SideBarOrientation.Left:
currentPosition = new Point(TabMarginLeft, i*(TabHeight + TabSpacing) + TabMarginTop);
tabRect = new Rectangle(currentPosition.X, currentPosition.Y, Width, TabHeight);
break;
case SideBarOrientation.Right:
currentPosition = new Point(TabMarginLeft, i*(TabHeight + TabSpacing) + TabMarginTop);
tabRect = new Rectangle(currentPosition.X - TabMarginLeft*2, currentPosition.Y, Width, TabHeight);
break;
}
var leftFormat = new StringFormat();
leftFormat.LineAlignment = StringAlignment.Center;
leftFormat.Alignment = StringAlignment.Near;
if (i == SelectedIndex || i == hoverIndex)
{
var gradient = new Rectangle(tabRect.X + 1, tabRect.Y + 1, tabRect.Width - 3, (tabRect.Height - 1)/2);
if (i == SelectedIndex)
{
helper.RoundedFill(UColor.White, tabRect, 4);
}
if (i == hoverIndex)
{
helper.RoundedFill(UColor.Blend(0x50, UColor.White), tabRect, 4);
}
helper.RoundedGradient(UColor.Blend(0x05, UColor.Black), UColor.Blend(0x20, UColor.Black), tabRect,
90, 4);
if (i == SelectedIndex)
{
helper.RoundedGradient(UColor.Blend(0xdd, UColor.White), UColor.White, gradient, 90, 4);
}
helper.RoundedOutline(UColor.Blend(0x60, UColor.White), tabRect.Inflated(1), 4);
if (i == SelectedIndex)
{
helper.RoundedOutline(UColor.Blend(0x90, UColor.Black), tabRect, 4);
}
else if (i == hoverIndex)
{
helper.RoundedOutline(UColor.Blend(0x50, UColor.Black), tabRect, 4);
}
}
if (tab.Changed)
{
helper.RoundedFill(UColor.Blend(0x30, UColor.White), tabRect, 4);
helper.RoundedFill(UColor.Blend(0x20, UColor.Red), tabRect, 4);
}
if (tab.HasIcon)
{
e.Graphics.DrawImage(tab.Icon,
new Point(currentPosition.X + TabMarginLeft, currentPosition.Y + TabHeight/2 - tab.Icon.Height/2));
currentPosition.Offset(TabMarginLeft + 2 + tab.Icon.Width, 0);
}
textRect = new Rectangle(currentPosition.X, currentPosition.Y, Width, TabHeight);
if (i == SelectedIndex)
{
helper.Text(tab.Caption, Font, UColor.Blend(0xff, UColor.White), textRect.ShrinkedY(-2), leftFormat);
helper.Text(tab.Caption, Font, UColor.Blend(0xdd, UColor.Black), textRect, leftFormat);
}
else
{
helper.Text(tab.Caption, Font, UColor.Blend(0xee, UColor.Black), textRect.ShrinkedY(-2), leftFormat);
helper.Text(tab.Caption, Font, UColor.Blend(0xff, UColor.White), textRect, leftFormat);
}
}
}