本文整理汇总了C#中System.Drawing.Drawing2D.GraphicsPath.AddPie方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Drawing2D.GraphicsPath.AddPie方法的具体用法?C# System.Drawing.Drawing2D.GraphicsPath.AddPie怎么用?C# System.Drawing.Drawing2D.GraphicsPath.AddPie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Drawing2D.GraphicsPath
的用法示例。
在下文中一共展示了System.Drawing.Drawing2D.GraphicsPath.AddPie方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawHover
public void DrawHover(Graphics graphics, Rectangle bounds, double hoverDone)
{
using (Bitmap b = new Bitmap(mBackgroundImage, bounds.Size))
graphics.DrawImage(b, bounds.Location);
var path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddPie(bounds.X, bounds.Y, bounds.Width, bounds.Height, -90f, (float) (360 * hoverDone));
graphics.SetClip(path);
using (Bitmap b = new Bitmap(mImage, bounds.Size))
graphics.DrawImage(b, bounds.Location);
graphics.ResetClip();
}
示例2: updateBorder
private void updateBorder()
{
var imeInfo = _monitor.IMEStatus;
_lastImeStatus = imeInfo;
if (imeInfo.WindowHandle == this.Handle || !imeInfo.WindowVisible || imeInfo.Ignored) {
this.Opacity = 0f;
setTopMost(false);
}
else {
var borderWidth = imeInfo.IMEEnabled ?
_settings.ImeOnBorderStyle.Width :
_settings.ImeOffBorderStyle.Width;
Rectangle windowRect = imeInfo.ClientBounds;
windowRect.Inflate(borderWidth, borderWidth);
// スクリーン外にはみ出た部分を押し込む
Rectangle screenRect = Screen.FromHandle(imeInfo.ClientHandle).Bounds;
{
int left = windowRect.X;
int top = windowRect.Y;
int right = windowRect.Right;
int bottom = windowRect.Bottom;
if (left < screenRect.X) left = screenRect.X;
if (top < screenRect.Y) top = screenRect.Y;
if (right > screenRect.Right) right = screenRect.Right;
if (bottom > screenRect.Bottom) bottom = screenRect.Bottom;
windowRect = Rectangle.FromLTRB(left, top, right, bottom);
}
if (this.Size == windowRect.Size) {
this.Location = windowRect.Location;
}
else {
var path = new System.Drawing.Drawing2D.GraphicsPath();
var w = windowRect.Width;
var h = windowRect.Height;
var border2x = borderWidth * 2;
path.AddPie(0, 0, border2x, border2x, 180, 90);
path.AddPie(w - border2x, 0, border2x, border2x, 270, 90);
path.AddPie(0, h - border2x, border2x, border2x, 90, 90);
path.AddPie(w - border2x, h - border2x, border2x, border2x, 0, 90);
path.AddRectangle(new Rectangle(0, borderWidth, borderWidth, h - border2x));
path.AddRectangle(new Rectangle(borderWidth, 0, w - border2x, borderWidth));
path.AddRectangle(new Rectangle(w - borderWidth, borderWidth, borderWidth, h - border2x));
path.AddRectangle(new Rectangle(borderWidth, h - borderWidth, w - border2x, borderWidth));
this.Region = new Region(path);
this.Bounds = windowRect;
}
this.BackColor = imeInfo.IMEEnabled ?
_settings.ImeOnBorderStyle.GetColor() :
_settings.ImeOffBorderStyle.GetColor();
this.Opacity = imeInfo.IMEEnabled ?
_settings.ImeOnBorderStyle.Opacity :
_settings.ImeOffBorderStyle.Opacity;
setTopMost(true);
}
}
示例3: CreateArc2D
/// <summary>
/// Creates a GraphicsPath object and adds an arc to it with the specified arc values and closure type.
/// </summary>
/// <param name="ellipseBounds">A RectangleF structure that represents the rectangular bounds of the ellipse from which the arc is taken.</param>
/// <param name="start">The starting angle of the arc measured in degrees.</param>
/// <param name="extent">The angular extent of the arc measured in degrees.</param>
/// <param name="arcType">The closure type for the arc.</param>
/// <returns>Returns a new GraphicsPath object that contains the arc path.</returns>
public static System.Drawing.Drawing2D.GraphicsPath CreateArc2D(System.Drawing.RectangleF ellipseBounds, float start, float extent, int arcType)
{
System.Drawing.Drawing2D.GraphicsPath arc2DPath = new System.Drawing.Drawing2D.GraphicsPath();
switch (arcType)
{
case OPEN:
arc2DPath.AddArc(ellipseBounds, start * -1, extent * -1);
break;
case CLOSED:
arc2DPath.AddArc(ellipseBounds, start * -1, extent * -1);
arc2DPath.CloseFigure();
break;
case PIE:
arc2DPath.AddPie(ellipseBounds.X, ellipseBounds.Y, ellipseBounds.Width, ellipseBounds.Height, start * -1, extent * -1);
break;
default:
break;
}
return arc2DPath;
}
示例4: CalculateSegments
private void CalculateSegments()
{
Rectangle rctFull = new Rectangle( 0, 0, Width, Height );
Rectangle rctInner = new Rectangle( ((Width * 7) / 30),
((Height * 7) / 30),
(Width - ((Width * 14 ) / 30 )),
(Height - ((Height * 14) / 30 )));
System.Drawing.Drawing2D.GraphicsPath pthInnerBackground;
// Create 12 segment pieces
for ( int intCount=0; intCount < 12; intCount++ )
{
segmentPaths[ intCount ] = new System.Drawing.Drawing2D.GraphicsPath();
// We subtract 90 so that the starting segment is at 12 o'clock
segmentPaths[ intCount ].AddPie( rctFull, ( intCount * 30 ) - 90, 25 );
}
// Create the center circle cut-out
pthInnerBackground = new System.Drawing.Drawing2D.GraphicsPath();
pthInnerBackground.AddPie( rctInner, 0, 360 );
innerBackgroundRegion = new Region( pthInnerBackground );
}