本文整理汇总了C#中System.Drawing.Color.Darker方法的典型用法代码示例。如果您正苦于以下问题:C# Color.Darker方法的具体用法?C# Color.Darker怎么用?C# Color.Darker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Color
的用法示例。
在下文中一共展示了Color.Darker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBorders
private void DrawBorders(Graphics g, Color baseColor)
{
Color light = baseColor.Lighter(.3F);
Color dark = baseColor.Darker(.3F);
Color topLeftColor = light;
Color bottomRightColor = dark;
if (_state.IsPressed())
{
topLeftColor = dark;
bottomRightColor = light;
}
Pen topLeftPen = new Pen(topLeftColor);
Pen bottomRightPen = new Pen(bottomRightColor);
Pen middlePen = new Pen(baseColor);
float l = Bounds.Left;
float r = Bounds.Right;
float t = Bounds.Top;
float b = Bounds.Bottom;
// Straight line parts
g.DrawLine(topLeftPen, l + 1F, t, r - 1F, t);
g.DrawLine(bottomRightPen, l + 1F, b, r - 1F, b);
g.DrawLine(topLeftPen, l, t + 1F, l, b - 1F);
g.DrawLine(bottomRightPen, r, t + 1F, r, b - 1F);
// "rounded" corner lines
g.DrawLine(topLeftPen, l, t + 2F, l + 2F, t);
g.DrawLine(middlePen, r - 2F, t, r, t + 2F);
g.DrawLine(middlePen, l, b - 2F, l + 2F, b);
g.DrawLine(bottomRightPen, r, b - 2F, r - 2F, b);
topLeftPen.Dispose();
bottomRightPen.Dispose();
middlePen.Dispose();
}