本文整理汇总了C#中System.Drawing.Drawing2D.HatchBrush类的典型用法代码示例。如果您正苦于以下问题:C# HatchBrush类的具体用法?C# HatchBrush怎么用?C# HatchBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HatchBrush类属于System.Drawing.Drawing2D命名空间,在下文中一共展示了HatchBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SnakePit
public SnakePit()
{
this.screen = DeviceGraphics.GetScreen();
this.screen.Clear(Color.White);
this.numCellsX = (DeviceGraphics.ScreenXSize / cellSize) - 2;
this.numCellsY = ((DeviceGraphics.ScreenYSize - scoreBoardHeight) / cellSize) - 2;
this.cellOfsX = cellSize;
this.cellOfsY = cellSize;
this.rnd = new Random();
this.food = null;
this.score = 0;
this.level = 1;
using (Brush brush = new HatchBrush(HatchStyle.DiagonalCross, Color.Black, Color.White)) {
this.screen.FillRectangle(brush, 0, 0, DeviceGraphics.ScreenXSize, cellSize);
this.screen.FillRectangle(brush, 0, cellSize, cellSize, this.numCellsY * cellSize);
this.screen.FillRectangle(brush, (1 + this.numCellsX) * cellSize, cellSize, cellSize, this.numCellsY * cellSize);
this.screen.FillRectangle(brush, 0, (1 + this.numCellsY) * cellSize, DeviceGraphics.ScreenXSize, cellSize);
}
this.screen.DrawRectangle(Pens.Black, cellSize - 1, cellSize - 1,
this.numCellsX * cellSize + 1, this.numCellsY * cellSize + 1);
using (Font f = new Font("tahoma", 15)) {
using (StringFormat sf = new StringFormat()) {
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
this.screen.DrawString("<", f, Brushes.Black, new RectangleF(0, 220, 64, 20), sf);
this.screen.DrawString("v", f, Brushes.Black, new RectangleF(64, 220, 64, 20), sf);
this.screen.DrawString("^", f, Brushes.Black, new RectangleF(128, 220, 64, 20), sf);
this.screen.DrawString(">", f, Brushes.Black, new RectangleF(192, 220, 64, 20), sf);
}
}
this.ShowScore();
}
开发者ID:memsom,项目名称:dotNetAnywhere-wb,代码行数:35,代码来源:SnakePit.cs
示例2: HatchBrushes_Paint
private void HatchBrushes_Paint(object sender, PaintEventArgs e)
{
int y = 20;
int x = 20;
Font font = new Font("Tahoma", 8);
// Enumerate over all the styles.
foreach (HatchStyle brushStyle in System.Enum.GetValues(typeof(HatchStyle)))
{
HatchBrush myBrush = new HatchBrush(brushStyle, Color.Blue, Color.LightYellow);
// Fill a rectangle with the brush.
e.Graphics.FillRectangle(myBrush, x, y, 40, 20);
// Display the brush name.
e.Graphics.DrawString(brushStyle.ToString(), font,
Brushes.Black, 50 + x, y + 5);
y += 30;
if ((y + 30) > this.ClientSize.Height)
{
y = 20;
x += 180;
}
myBrush.Dispose();
}
font.Dispose();
}
开发者ID:ehershey,项目名称:development,代码行数:29,代码来源:HatchBrushes.cs
示例3: CreateImages
/*产生验证图片*/
public void CreateImages(string code)
{
int fontsize = 20;
int width = code.Length * fontsize;
int height = fontsize + 8;
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bmp);
HatchBrush b = new HatchBrush(HatchStyle.DiagonalCross, Color.LightGray, Color.WhiteSmoke);
g.FillRectangle(b, 0, 0, width, height);
Random random = new Random();
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(
new Rectangle(0, 0, bmp.Width, bmp.Height), Color.Black, Color.FromArgb(120, 120, 120), 20.0f, true);
g.DrawString(code, new Font("Courier New", fontsize, FontStyle.Bold), brush, 2.0F, 1.0F);
//画图片的前景噪音点
for (int i = 0; i < 50; i++)
{
int x = random.Next(bmp.Width);
int y = random.Next(bmp.Height);
bmp.SetPixel(x, y, Color.Green);
}
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
b.Dispose();
g.Dispose();
bmp.Dispose();
}
开发者ID:ViniciusConsultor,项目名称:noname-netshop,代码行数:32,代码来源:ValiateCode.aspx.cs
示例4: DrawRect
// This is basically the same as Example1_5 except that it uses
// a page unit of Inches
public override void DrawRect(System.Drawing.RectangleF dirtyRect)
{
Graphics g = new Graphics();
g.Clear(Color.Wheat);
// Create a pen object:
Pen aPen = new Pen(Color.Blue, 1 / g.DpiX);
// Create a brush object with a transparent red color:
SolidBrush aBrush = new SolidBrush(Color.Red);
g.PageUnit = GraphicsUnit.Inch;
g.PageScale = 2;
g.RenderingOrigin = new PointF(0.5f,0.0f);
// Draw a rectangle:
g.DrawRectangle(aPen, .20f, .20f, 1.00f, .50f);
// Draw a filled rectangle:
g.FillRectangle(aBrush, .20f, .90f, 1.00f, .50f);
// Draw ellipse:
g.DrawEllipse(aPen, new RectangleF(.20f, 1.60f, 1.00f, .50f));
// Draw filled ellipse:
HatchBrush hBrush = new HatchBrush(HatchStyle.Horizontal, Color.Blue, Color.LightCoral);
g.FillEllipse(hBrush, new RectangleF(1.70f, .20f, 1.00f, .50f));
//g.FillEllipse(aBrush, new RectangleF(1.70f, .20f, 1.00f, .50f));
// Draw arc:
g.DrawArc(aPen, new RectangleF(1.70f, .90f, 1.00f, .50f), -90, 180);
// Draw filled pie pieces
g.FillPie(aBrush, 1.70f, 1.60f, 1.00f, 1.00f, -90, 90);
g.FillPie(Brushes.Green, 1.70f, 1.60f, 1.00f, 1.00f, -90, -90);
g.Dispose();
}
开发者ID:stnk3000,项目名称:sysdrawing-coregraphics,代码行数:37,代码来源:DrawingView.cs
示例5: CreateImage
/// <summary>
/// ������֤�룬����һ�� Image ����
/// </summary>
/// <param name="code"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="fontFamily"></param>
/// <returns></returns>
public Image CreateImage( String code, int width, int height, String fontFamily )
{
Bitmap bm = new Bitmap( width, height );
using (Graphics g = Graphics.FromImage( bm )) {
g.SmoothingMode = SmoothingMode.AntiAlias;
HatchBrush brush = new HatchBrush( HatchStyle.SmallConfetti, Color.LightGray, Color.White );
Rectangle rect = new Rectangle( 0, 0, width, height );
g.FillRectangle( brush, rect );
int fontsize = rect.Height + 1;
FontAndSize size = FontAndSize.GetValue( g, code, fontFamily, fontsize, bm.Width );
GraphicsPath gpath = getGraphicsPath( code, size.font, rect );
Color brushColor = ColorTranslator.FromHtml( "#000000" );
brush = new HatchBrush( HatchStyle.Divot, brushColor, Color.DarkGray );
g.FillPath( brush, gpath );
addRandomNoise( g, rect );
}
return bm;
}
开发者ID:jilumvc,项目名称:Sajoo,代码行数:34,代码来源:ValidationCode.cs
示例6: GenerateImage
public Bitmap GenerateImage()
{
int a = random.Next(_maxNumber);
int b = random.Next(_maxNumber);
_answer = (a + b).ToString();
string text = string.Format("{0} + {1} = ", a, b);
Bitmap bitmap = new Bitmap(_width, _height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(0, 0, _width, _height);
HatchBrush hatchBrush = new HatchBrush(HatchStyle.SmallConfetti, _foreColor, _bgColor);
g.FillRectangle(hatchBrush, rect);
SizeF size;
float fontSize = rect.Height + 1;
Font font;
do
{
fontSize--;
font = new Font(_familyName, fontSize, FontStyle.Bold);
size = g.MeasureString(text, font);
} while (size.Width > rect.Width);
// Set up the text format.
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
// Create a path using the text and warp it randomly.
GraphicsPath path = new GraphicsPath();
path.AddString(text, font.FontFamily, (int)font.Style, font.Size, rect, format);
float v = 4F;
PointF[] points =
{
new PointF(random.Next(rect.Width) / v, random.Next(rect.Height) / v),
new PointF(rect.Width - random.Next(rect.Width) / v, random.Next(rect.Height) / v),
new PointF(random.Next(rect.Width) / v, rect.Height - random.Next(rect.Height) / v),
new PointF(rect.Width - random.Next(rect.Width) / v, rect.Height - random.Next(rect.Height) / v)
};
Matrix matrix = new Matrix();
matrix.Translate(0F, 0F);
path.Warp(points, rect, matrix, WarpMode.Perspective, 0F);
hatchBrush = new HatchBrush(HatchStyle.SolidDiamond, _foreColor, _foreColor);
g.FillPath(hatchBrush, path);
// Add some random noise.
int m = Math.Max(rect.Width, rect.Height);
for (int i = 0; i < (int)(rect.Width * rect.Height / 30F); i++)
{
int x = random.Next(rect.Width);
int y = random.Next(rect.Height);
int w = random.Next(m / 50);
int h = random.Next(m / 50);
g.FillEllipse(hatchBrush, x, y, w, h);
}
return bitmap;
}
开发者ID:evkap,项目名称:DVS,代码行数:60,代码来源:Captcha.cs
示例7: WorkSpace_Paint
private void WorkSpace_Paint(object sender, PaintEventArgs e)
{
if (!this.dragimage)
this.pictureBox1.Location = new Point(this.idx + (this.Width / 2) - (this.pictureBox1.Width / 2), this.idy + (this.Height / 2) - (this.pictureBox1.Height / 2));
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
LinearGradientBrush brush1 = new LinearGradientBrush(new Rectangle(0, 0, ((WorkSpace)sender).Width, ((WorkSpace)sender).Height / 2), Color.FromArgb(255, 155, 160, 179), Color.FromArgb(255, 114, 125, 153), LinearGradientMode.Vertical);
brush1.WrapMode = WrapMode.TileFlipX;
HatchBrush brush2 = new HatchBrush(HatchStyle.Percent75, Color.Transparent, Color.FromArgb(255, 169, 175, 199));
e.Graphics.FillRectangle(brush1, 0, 0, ((WorkSpace)sender).Width, ((WorkSpace)sender).Height);
e.Graphics.FillRectangle(brush2, 0, 0, ((WorkSpace)sender).Width, ((WorkSpace)sender).Height);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(32, 0, 0, 0)), this.pictureBox1.Location.X - 3, this.pictureBox1.Location.Y - 3, this.pictureBox1.Width + 6, this.pictureBox1.Height + 6);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(32, 0, 0, 0)), this.pictureBox1.Location.X - 2, this.pictureBox1.Location.Y - 2, this.pictureBox1.Width + 4, this.pictureBox1.Height + 4);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(32, 0, 0, 0)), this.pictureBox1.Location.X - 1, this.pictureBox1.Location.Y - 1, this.pictureBox1.Width + 2, this.pictureBox1.Height + 2);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(16, 0, 0, 0)), this.pictureBox1.Location.X, this.pictureBox1.Location.Y, this.pictureBox1.Width + 4, this.pictureBox1.Height + 4);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(16, 0, 0, 0)), this.pictureBox1.Location.X, this.pictureBox1.Location.Y, this.pictureBox1.Width + 5, this.pictureBox1.Height + 5);
if (this.dragimage)
{
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.LightSteelBlue)), new Rectangle(new Point(this.idx + (this.Width / 2) - (this.pictureBox1.Width / 2), this.idy + (this.Height / 2) - (this.pictureBox1.Width / 2)), this.pictureBox1.Size));
e.Graphics.DrawRectangle(Pens.LightSteelBlue, new Rectangle(new Point(this.idx + (this.Width / 2) - (this.pictureBox1.Width / 2), this.idy + (this.Height / 2) - (this.pictureBox1.Width / 2)), this.pictureBox1.Size));
}
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:27,代码来源:WorkSpace.cs
示例8: FillPath
/// <summary>
/// Instructs the drawing code to fill the specified path with the specified pattern
/// </summary>
/// <param name="g">The System.Drawing.Graphics device to draw to</param>
/// <param name="gp">The System.Drawing.Drawing2D.GraphicsPath to fill</param>
public override void FillPath(Graphics g, GraphicsPath gp)
{
System.Drawing.Drawing2D.HatchBrush hb = new HatchBrush(_hatchStyle, _foreColor, _backColor);
g.FillPath(hb, gp);
hb.Dispose();
base.FillPath(g, gp);
}
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:12,代码来源:HatchPattern.cs
示例9: FillImageByHatch
protected void FillImageByHatch(Image img, HatchStyle s)
{
Graphics g = Graphics.FromImage(img);
HatchBrush brush = new HatchBrush(s, Color.Black, Color.White);
g.FillRectangle(brush, new Rectangle(0, 0, img.Width, img.Height));
g.Dispose();
}
开发者ID:stndstn,项目名称:PaintPlus,代码行数:7,代码来源:FormHatchStyleDlg.cs
示例10: BrushesExampleMethod
public static void BrushesExampleMethod(Graphics g)
{
Color pink = Color.FromArgb(241, 105, 190);
SolidBrush sldBrush = new SolidBrush(pink);
g.FillRectangle(sldBrush, 300, 150, 70, 70);
HatchBrush hBrush = new HatchBrush(HatchStyle.NarrowVertical, Color.Pink, Color.Blue);
g.FillRectangle(hBrush, 370, 150, 70, 70);
sldBrush = new SolidBrush(Color.Orchid);
g.FillRectangle(sldBrush, 440, 150, 70, 70);
LinearGradientBrush lgBrush = new LinearGradientBrush(new Rectangle(0, 0, 20, 20), Color.Violet, Color.LightSteelBlue, LinearGradientMode.Vertical);
g.FillRectangle(lgBrush, 300, 220, 70, 70);
g.FillRectangle(Brushes.Indigo, 370, 220, 70, 70);
sldBrush = new SolidBrush(Color.Orange);
g.FillRectangle(sldBrush, 440, 220, 70, 70);
lgBrush = new LinearGradientBrush(new RectangleF(0, 0, 90, 90), Color.BlueViolet, Color.LightPink, LinearGradientMode.BackwardDiagonal);
g.FillRectangle(lgBrush, 300, 290, 70, 70);
TextureBrush tBrush = new TextureBrush(Image.FromFile(@"Images\csharp.jpg"));
g.FillRectangle(tBrush, 370, 290, 70, 70);
tBrush = new TextureBrush(Image.FromFile(@"Images\003.jpg"));
g.FillRectangle(tBrush, 440, 290, 70, 70);
}
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:30,代码来源:Cub.cs
示例11: Signal
public Signal()
{
data = new List<SignalEntry>();
Brush b =
b = new HatchBrush(HatchStyle.DarkVertical, Color.Black, Color.White);
}
开发者ID:jaroban,项目名称:Embedded,代码行数:7,代码来源:Signal.cs
示例12: ColorComboBox_DrawItem
void ColorComboBox_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
if (e.Index >= 0)
{
Rectangle rectangle = new Rectangle(4, e.Bounds.Top + 2, 30, e.Bounds.Height - 4);
Color rectColor = (Color)Items[e.Index];
e.Graphics.FillRectangle(new SolidBrush(rectColor), rectangle);
e.Graphics.DrawRectangle(System.Drawing.Pens.Black, rectangle);
if (e.Index == 0)
{
e.Graphics.DrawString("Custom", e.Font, System.Drawing.Brushes.Black,
new PointF(42, e.Bounds.Top + 2));
}
else
{
e.Graphics.DrawString(((Color)Items[e.Index]).Name, e.Font, System.Drawing.Brushes.Black,
new PointF(42, e.Bounds.Top + 2));
}
if (!Enabled)
{
HatchBrush brush = new HatchBrush(HatchStyle.Percent50, Color.LightGray, Color.FromArgb(10, Color.LightGray));
rectangle.Inflate(1, 1);
e.Graphics.FillRectangle(brush, rectangle);
brush.Dispose();
}
e.DrawFocusRectangle();
}
}
开发者ID:gspatace,项目名称:logexpert,代码行数:29,代码来源:ColorComboBox.cs
示例13: DefaultTimelineRenderer
/// <summary>
/// Constructor</summary>
/// <param name="font">Font to use for rendering timeline text</param>
public DefaultTimelineRenderer(Font font)
: base(font)
{
m_selectedPen = new Pen(Color.Tomato, 3);
Color lightGray = Color.LightGray;
m_collapsedBrush = new SolidBrush(lightGray);
m_invalidBrush = new HatchBrush(HatchStyle.ForwardDiagonal, Color.DimGray, Color.FromArgb(0, 0, 0, 0));
}
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:11,代码来源:DefaultTimelineRenderer.cs
示例14: PaintValue
public override void PaintValue(PaintValueEventArgs e)
{
Hatcher hatch = e.Value as Hatcher;
using (HatchBrush brush = new HatchBrush(hatch.HatchType, hatch.ForeColor, hatch.BackColor))
{
e.Graphics.FillRectangle(brush, e.Bounds);
}
}
开发者ID:KelvinCoding,项目名称:masterwork-dwarf-fortress,代码行数:8,代码来源:HatcherEditor.cs
示例15: GenerateImage
private void GenerateImage()
{
Bitmap bitmap = new Bitmap
(this.width, this.height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(0, 0, this.width, this.height);
HatchBrush hatchBrush = new HatchBrush(HatchStyle.SmallConfetti,
Color.LightGray, Color.White);
g.FillRectangle(hatchBrush, rect);
SizeF size;
float fontSize = rect.Height + 1;
Font font;
do
{
fontSize--;
font = new Font(FontFamily.GenericSansSerif, fontSize, FontStyle.Bold);
size = g.MeasureString(this.text, font);
} while (size.Width > rect.Width);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
GraphicsPath path = new GraphicsPath();
//path.AddString(this.text, font.FontFamily, (int) font.Style,
// font.Size, rect, format);
path.AddString(this.text, font.FontFamily, (int)font.Style, 75, rect, format);
float v = 4F;
PointF[] points =
{
new PointF(this.random.Next(rect.Width) / v, this.random.Next(
rect.Height) / v),
new PointF(rect.Width - this.random.Next(rect.Width) / v,
this.random.Next(rect.Height) / v),
new PointF(this.random.Next(rect.Width) / v,
rect.Height - this.random.Next(rect.Height) / v),
new PointF(rect.Width - this.random.Next(rect.Width) / v,
rect.Height - this.random.Next(rect.Height) / v)
};
Matrix matrix = new Matrix();
matrix.Translate(0F, 0F);
path.Warp(points, rect, matrix, WarpMode.Perspective, 0F);
hatchBrush = new HatchBrush(HatchStyle.Percent10, Color.Black, Color.SkyBlue);
g.FillPath(hatchBrush, path);
int m = Math.Max(rect.Width, rect.Height);
for (int i = 0; i < (int)(rect.Width * rect.Height / 30F); i++)
{
int x = this.random.Next(rect.Width);
int y = this.random.Next(rect.Height);
int w = this.random.Next(m / 50);
int h = this.random.Next(m / 50);
g.FillEllipse(hatchBrush, x, y, w, h);
}
font.Dispose();
hatchBrush.Dispose();
g.Dispose();
this.image = bitmap;
}
开发者ID:htphongqn,项目名称:esell.yeuthietkeweb.com,代码行数:58,代码来源:RandomImage.cs
示例16: Build
public override Bitmap Build(string text)
{
var random = new Random();
var bitmap = new Bitmap
(Width, Height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.SmoothingMode = SmoothingMode.AntiAlias;
var rect = new Rectangle(0, 0, Width, Height);
var hatchBrush = new HatchBrush(HatchStyle.SmallConfetti,
Color.LightGray, Color.White);
g.FillRectangle(hatchBrush, rect);
SizeF size;
float fontSize = rect.Height + 1;
Font font;
do
{
fontSize--;
font = new Font(FontFamily.GenericSansSerif, fontSize, FontStyle.Bold);
size = g.MeasureString(text, font);
} while (size.Width > rect.Width);
var format = new StringFormat {Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center};
var path = new GraphicsPath();
//path.AddString(this.text, font.FontFamily, (int) font.Style,
// font.Size, rect, format);
path.AddString(text, font.FontFamily, (int) font.Style, 75, rect, format);
float v = 4F;
PointF[] points =
{
new PointF(random.Next(rect.Width)/v, random.Next(
rect.Height)/v),
new PointF(rect.Width - random.Next(rect.Width)/v,
random.Next(rect.Height)/v),
new PointF(random.Next(rect.Width)/v,
rect.Height - random.Next(rect.Height)/v),
new PointF(rect.Width - random.Next(rect.Width)/v,
rect.Height - random.Next(rect.Height)/v)
};
var matrix = new Matrix();
matrix.Translate(0F, 0F);
path.Warp(points, rect, matrix, WarpMode.Perspective, 0F);
hatchBrush = new HatchBrush(HatchStyle.Percent10, Color.Black, Color.SkyBlue);
g.FillPath(hatchBrush, path);
int m = Math.Max(rect.Width, rect.Height);
for (int i = 0; i < (int) (rect.Width*rect.Height/30F); i++)
{
int x = random.Next(rect.Width);
int y = random.Next(rect.Height);
int w = random.Next(m/50);
int h = random.Next(m/50);
g.FillEllipse(hatchBrush, x, y, w, h);
}
font.Dispose();
hatchBrush.Dispose();
g.Dispose();
return bitmap;
}
开发者ID:luqizheng,项目名称:OrnamentFramework,代码行数:57,代码来源:BubbleVerifyCodeBuilder.cs
示例17: Draw
public static void Draw(Graphics g)
{
Point[] p = { new Point(240, 110), new Point(440, 110), new Point(510, 150), new Point(300, 150) };
TextureBrush tBrush = new TextureBrush(Image.FromFile(@"Images\0073.jpg"));
g.FillPolygon(tBrush, p);
Point[] p1 = { new Point(240, 110), new Point(300, 150), new Point(300, 360), new Point(240, 310) };
HatchBrush hBrush = new HatchBrush(HatchStyle.DashedDownwardDiagonal, Color.Violet, Color.White);
g.FillPolygon(hBrush, p1);
}
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:10,代码来源:Cub.cs
示例18: CreateHatchPen
Pen CreateHatchPen(Color color, float width)
{
Brush brush = new HatchBrush(HatchStyle.DarkUpwardDiagonal, // WideDownwardDiagonal,
// Color.FromArgb(0, 255, 255, 255),
Color.FromArgb(0, 254, 254, 254),
Color.FromArgb(255, color)
); // back
return new Pen(brush,
width); // 可修改
}
开发者ID:paopaofeng,项目名称:dp2,代码行数:10,代码来源:LineLayerForm.cs
示例19: GlobalRenderingSettingData
/// <summary>デフォルトコンストラクタ。</summary>
public GlobalRenderingSettingData()
{
BackgroundColor = new ColorEx( 255, 0, 0, 0 );
SelectedObjectBorder = Pens.Yellow;
SelectedObjectFill = new HatchBrush( HatchStyle.Percent25, Color.Yellow );
InvalidObjectBorder = Pens.Red;
InvalidObjectFill = new HatchBrush( HatchStyle.Percent25, Color.Red );
DisabledObjectBorder = Pens.Gray;
DisabledObjectFill = new HatchBrush( HatchStyle.Percent25, Color.Gray );
}
开发者ID:DaishiNakase,项目名称:WaveguideDesigner,代码行数:11,代码来源:GlobalRenderingSettingData.cs
示例20: DrawRect
public override void DrawRect(CGRect dirtyRect)
{
Graphics g = Graphics.FromCurrentContext();
g.Clear(Color.White);
g.SmoothingMode = SmoothingMode.AntiAlias;
// Create a pen object:
Pen aPen = new Pen(Color.Blue, 2);
// Create a brush object with a transparent red color:
SolidBrush aBrush = new SolidBrush(Color.Red);
HatchBrush hBrush = new HatchBrush(HatchStyle.Shingle, Color.Blue, Color.LightCoral);
HatchBrush hBrush2 = new HatchBrush(HatchStyle.Cross, Color.Blue, Color.LightCoral);
HatchBrush hBrush3 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Blue, Color.LightCoral);
HatchBrush hBrush4 = new HatchBrush(HatchStyle.Sphere, Color.Blue, Color.LightCoral);
// Draw a rectangle:
g.DrawRectangle(aPen, 20, 20, 100, 50);
// Draw a filled rectangle:
g.FillRectangle(hBrush, 20, 90, 100, 50);
// Draw ellipse:
g.DrawEllipse(aPen, new Rectangle(20, 160, 100, 50));
// Draw filled ellipse:
g.FillEllipse(hBrush2, new Rectangle(170, 20, 100, 50));
// Draw arc:
g.DrawArc(aPen, new Rectangle(170, 90, 100, 50), -90, 180);
// Draw filled pie pieces
g.FillPie(aBrush, new Rectangle(170, 160, 100, 100), -90, 90);
g.FillPie(hBrush4, new Rectangle(170, 160, 100, 100), -90, -90);
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
greenPen.DashStyle = DashStyle.DashDotDot;
SolidBrush transparentBrush = new SolidBrush(Color.FromArgb(150, Color.Wheat));
// define point array to draw a curve:
Point point1 = new Point(300, 250);
Point point2 = new Point(350, 125);
Point point3 = new Point(400, 110);
Point point4 = new Point(450, 210);
Point point5 = new Point(500, 300);
Point[] curvePoints ={ point1, point2, point3, point4, point5};
// Draw lines between original points to screen.
g.DrawLines(redPen, curvePoints);
// Fill Curve
g.FillClosedCurve(transparentBrush, curvePoints);
// Draw closed curve to screen.
g.DrawClosedCurve(greenPen, curvePoints);
g.Dispose();
}
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:55,代码来源:DrawingView.cs
注:本文中的System.Drawing.Drawing2D.HatchBrush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论