本文整理汇总了C#中PaintDotNet.PdnRegion.GetRegionReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C# PdnRegion.GetRegionReadOnly方法的具体用法?C# PdnRegion.GetRegionReadOnly怎么用?C# PdnRegion.GetRegionReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintDotNet.PdnRegion
的用法示例。
在下文中一共展示了PdnRegion.GetRegionReadOnly方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGradient
//.........这里部分代码省略.........
}
g.DrawImage(ra.Bitmap, gradientRect, ra.Bounds, GraphicsUnit.Pixel);
}
else if (Orientation == Orientation.Vertical)
{
// TODO
}
else
{
throw new InvalidEnumArgumentException();
}
}
gradientSurface.Dispose();
}
else
{
using (LinearGradientBrush lgb = new LinearGradientBrush(this.ClientRectangle,
maxColor, minColor, gradientAngle, false))
{
g.FillRectangle(lgb, gradientRect);
}
}
// fill background
using (PdnRegion nonGradientRegion = new PdnRegion())
{
nonGradientRegion.MakeInfinite();
nonGradientRegion.Exclude(gradientRect);
using (SolidBrush sb = new SolidBrush(this.BackColor))
{
g.FillRegion(sb, nonGradientRegion.GetRegionReadOnly());
}
}
// draw value triangles
for (int i = 0; i < this.vals.Length; i++)
{
int pos = ValueToPosition(vals[i]);
Brush brush;
Pen pen;
if (i == highlight)
{
brush = Brushes.Blue;
pen = (Pen)Pens.White.Clone();
}
else
{
brush = Brushes.Black;
pen = (Pen)Pens.Gray.Clone();
}
g.SmoothingMode = SmoothingMode.AntiAlias;
Point a1;
Point b1;
Point c1;
Point a2;
Point b2;
Point c2;
switch (this.orientation)
示例2: DrawShadow
private void DrawShadow(Graphics g, Rectangle clipRect)
{
if (this.occludingControl != null)
{
// Draw the outline rectangle
Rectangle outlineRect = new Rectangle(new Point(0, 0), this.occludingControl.Size);
outlineRect = occludingControl.RectangleToScreen(outlineRect);
outlineRect = RectangleToClient(outlineRect);
outlineRect.X -= 1;
outlineRect.Y -= 1;
outlineRect.Width += 2;
outlineRect.Height += 2;
g.DrawLines(
Pens.Black,
new Point[]
{
new Point(outlineRect.Left, outlineRect.Top),
new Point(outlineRect.Right, outlineRect.Top),
new Point(outlineRect.Right, outlineRect.Bottom),
new Point(outlineRect.Left, outlineRect.Bottom),
new Point(outlineRect.Left, outlineRect.Top)
});
using (PdnRegion backRegion = new PdnRegion(clipRect))
{
Rectangle occludingRect = new Rectangle(0, 0, this.occludingControl.Width, this.occludingControl.Height);
occludingRect = this.occludingControl.RectangleToScreen(occludingRect);
occludingRect = RectangleToClient(occludingRect);
backRegion.Exclude(occludingRect);
backRegion.Exclude(outlineRect);
using (Brush backBrush = new SolidBrush(this.BackColor))
{
g.FillRegion(backBrush, backRegion.GetRegionReadOnly());
}
}
Rectangle edgeRect = new Rectangle(0, 0, this.roundedEdgeUL.Width, this.roundedEdgeUR.Height);
Rectangle ulEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Top - 3, this.roundedEdgeUL.Width, this.roundedEdgeUL.Height);
Rectangle urEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Top - 3, this.roundedEdgeUR.Width, this.roundedEdgeUR.Height);
Rectangle llEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Bottom - 3, this.roundedEdgeLL.Width, this.roundedEdgeLL.Height);
Rectangle lrEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Bottom - 3, this.roundedEdgeLR.Width, this.roundedEdgeLR.Height);
g.DrawImage(this.roundedEdgeUL, ulEdgeRect, edgeRect, GraphicsUnit.Pixel);
g.DrawImage(this.roundedEdgeUR, urEdgeRect, edgeRect, GraphicsUnit.Pixel);
g.DrawImage(this.roundedEdgeLL, llEdgeRect, edgeRect, GraphicsUnit.Pixel);
g.DrawImage(this.roundedEdgeLR, lrEdgeRect, edgeRect, GraphicsUnit.Pixel);
Color c1 = Color.FromArgb(95, Color.Black);
Color c2 = Color.FromArgb(47, Color.Black);
Color c3 = Color.FromArgb(15, Color.Black);
Pen p1 = new Pen(c1);
Pen p2 = new Pen(c2);
Pen p3 = new Pen(c3);
// Draw top soft edge
g.DrawLine(p1, ulEdgeRect.Right, outlineRect.Top - 1, urEdgeRect.Left - 1, outlineRect.Top - 1);
g.DrawLine(p2, ulEdgeRect.Right, outlineRect.Top - 2, urEdgeRect.Left - 1, outlineRect.Top - 2);
g.DrawLine(p3, ulEdgeRect.Right, outlineRect.Top - 3, urEdgeRect.Left - 1, outlineRect.Top - 3);
// Draw bottom soft edge
g.DrawLine(p1, llEdgeRect.Right, outlineRect.Bottom + 0, lrEdgeRect.Left - 1, outlineRect.Bottom + 0);
g.DrawLine(p2, llEdgeRect.Right, outlineRect.Bottom + 1, lrEdgeRect.Left - 1, outlineRect.Bottom + 1);
g.DrawLine(p3, llEdgeRect.Right, outlineRect.Bottom + 2, lrEdgeRect.Left - 1, outlineRect.Bottom + 2);
// Draw left soft edge
g.DrawLine(p1, outlineRect.Left - 1, ulEdgeRect.Bottom, outlineRect.Left - 1, llEdgeRect.Top - 1);
g.DrawLine(p2, outlineRect.Left - 2, ulEdgeRect.Bottom, outlineRect.Left - 2, llEdgeRect.Top - 1);
g.DrawLine(p3, outlineRect.Left - 3, ulEdgeRect.Bottom, outlineRect.Left - 3, llEdgeRect.Top - 1);
// Draw right soft edge
g.DrawLine(p1, outlineRect.Right + 0, urEdgeRect.Bottom, outlineRect.Right + 0, lrEdgeRect.Top - 1);
g.DrawLine(p2, outlineRect.Right + 1, urEdgeRect.Bottom, outlineRect.Right + 1, lrEdgeRect.Top - 1);
g.DrawLine(p3, outlineRect.Right + 2, urEdgeRect.Bottom, outlineRect.Right + 2, lrEdgeRect.Top - 1);
p1.Dispose();
p1 = null;
p2.Dispose();
p2 = null;
p3.Dispose();
p3 = null;
}
if (this.betaTagString != null)
{
Color betaTagColor = Color.FromArgb(this.betaTagOpacity, SystemColors.WindowText);
Brush betaTagBrush = new SolidBrush(betaTagColor);
StringFormat sf = (StringFormat)StringFormat.GenericTypographic.Clone();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Near;
g.DrawString(
this.betaTagString,
//.........这里部分代码省略.........