本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddRoundedRectangleBottomRight方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.AddRoundedRectangleBottomRight方法的具体用法?C# GraphicsPath.AddRoundedRectangleBottomRight怎么用?C# GraphicsPath.AddRoundedRectangleBottomRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath.AddRoundedRectangleBottomRight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDrawSlider
/// <summary>
/// Draws the slider itself in client coordinates
/// </summary>
/// <param name="g"></param>
/// <param name="clipRectangle"></param>
protected virtual void OnDrawSlider(Graphics g, Rectangle clipRectangle)
{
Color light = _sliderColor.Lighter(.3F);
Color dark = _sliderColor.Darker(.3F);
Point tl = new Point();
Point br = new Point();
double val = (Value - Minimum) / (Maximum - Minimum);
int x, y, w, h;
if (_orientation == Orientation.Horizontal)
{
w = 10;
int span = Width - w - 1;
float vSpan = _rampRectangle.Height - _rampRadius * 2;
y = _rampRectangle.Top;
if (_flipRamp)
{
x = (int)(span * (1 - val));
// h = (int)(_rampRadius * 2 + vSpan * (1 - val));
}
else
{
x = (int)(val * span);
}
h = (int)(_rampRadius * 2 + vSpan * val);
if (h < 10) h = 10;
if (_invertRamp == false)
{
y = _rampRectangle.Bottom - h;
}
}
else
{
h = 10;
int span = Height - h - 1;
x = _rampRectangle.Left;
float hSpan = _rampRectangle.Width - _rampRadius * 2;
if (_flipRamp)
{
y = (int)(span * val);
//w = (int)(_rampRadius * 2 + hSpan * (1 - val));
}
else
{
y = (int)(span * (1 - val));
}
w = (int)(_rampRadius * 2 + hSpan * val);
if (w < 10) w = 10;
if (_invertRamp == false)
{
x = _rampRectangle.Right - w;
}
}
if (x > _rampRectangle.Width) x = _rampRectangle.Width;
if (x < 0) x = 0;
if (y > _rampRectangle.Height) y = _rampRectangle.Height;
if (y < 0) y = 0;
tl.X = x;
tl.Y = y;
br.X = x + w;
br.Y = y + h;
try
{
LinearGradientBrush lgb = new LinearGradientBrush(tl, br, light, dark);
Rectangle bounds = new Rectangle(x, y, w, h);
_sliderRectangle = bounds;
GraphicsPath gp = new GraphicsPath();
gp.AddRoundedRectangle(bounds, (int)Math.Round(_sliderRadius));
g.FillPath(lgb, gp);
g.DrawPath(Pens.Gray, gp);
gp.Dispose();
GraphicsPath bottomRight = new GraphicsPath();
bottomRight.AddRoundedRectangleBottomRight(bounds, (int)Math.Round(_sliderRadius));
g.DrawPath(Pens.DarkGray, bottomRight);
bottomRight.Dispose();
lgb.Dispose();
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}