本文整理汇总了C#中System.Drawing.Brush类的典型用法代码示例。如果您正苦于以下问题:C# Brush类的具体用法?C# Brush怎么用?C# Brush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Brush类属于System.Drawing命名空间,在下文中一共展示了Brush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InterestPointDrawer
public InterestPointDrawer(Bitmap background, SRegion[] regions)
: base(background, regions)
{
Color c = Color.FromArgb(125, Color.Red);
pen = new Pen(c);
brush = new SolidBrush(c);
}
开发者ID:paveltimofeev,项目名称:Skin-analize,代码行数:7,代码来源:InterestPointDrawer.cs
示例2: ImageSplitter
public ImageSplitter(Image source, string format, int sizeX, int sizeY, int marginX, int marginY, Color background, Brush foreground)
{
_sizeX = sizeX;
_sizeY = sizeY;
_source = source;
_format = format;
_marginX = marginX;
_marginY = marginY;
_background = background;
_tileSizeX = _sizeX + 1;
_tileSizeY = _sizeY + 1;
_innerTilesX = (_source.Width - 1)/_sizeX;
_innerTilesY = (_source.Height - 1)/_sizeY;
_lastTileSizeX = (_source.Width - 1)%_sizeX + 1;
_lastTileSizeY = (_source.Height - 1)%_sizeY + 1;
_dirName = "out_" + _sizeX + "_" + _sizeY;
_combinedBitmap = new Bitmap(
_marginX + _innerTilesX * _tileSizeX + _lastTileSizeX,
_marginY + _innerTilesY * _tileSizeY + _lastTileSizeY);
_combinedG = Graphics.FromImage(_combinedBitmap);
_foreground = foreground;
}
开发者ID:gerich-home,项目名称:image-splitter,代码行数:25,代码来源:ImageSplitter.cs
示例3: DrawBrick
static protected void DrawBrick (Graphics graphics, Brush b1, Brush b2, Brush b3)
{
if (graphics == null) return;
graphics.FillPolygon (b1, brickPoints1);
graphics.FillPolygon (b2, brickPoints2);
graphics.FillPolygon (b3, brickPoints3);
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:MethodShape.cs
示例4: FillRoundedRectangle
public static void FillRoundedRectangle(this Graphics g, Brush brush, RectangleF rect, float topLeftCorner, float topRightCorner, float bottomLeftCorner, float bottomRightCorner)
{
using(var gp = GraphicsUtility.GetRoundedRectangle(rect, topLeftCorner, topRightCorner, bottomLeftCorner, bottomRightCorner))
{
g.FillPath(brush, gp);
}
}
开发者ID:Kuzq,项目名称:gitter,代码行数:7,代码来源:GraphicsExtensions.cs
示例5: DrawStringML
private static void DrawStringML(this Graphics G, string Text, Font font, Brush brush, float x, ref float y, float mX)
{
string[] words = Text.Split(' ');
float tempX = x;
float totalSpace = mX - x;
SizeF measureWord = new SizeF(0, font.GetHeight());
float tempWordWidth = 0;
foreach (string word in words)
{
//measure word width (based in font size)
tempWordWidth = G.MeasureString(word + " ", font).Width;
measureWord.Width += tempWordWidth;
//check if the word fits in free line space
//if not then change line
if (measureWord.Width > totalSpace)
{
y += font.GetHeight();
tempX = x;
measureWord.Width = tempWordWidth;
}
G.DrawString(word + " ", font, brush, tempX, y);
tempX += tempWordWidth;
}
y += font.GetHeight();
}
开发者ID:Hli4S,项目名称:TestMeApp,代码行数:25,代码来源:Print.cs
示例6: Draw
public void Draw(Graphics gr, Pen pen, Brush backgroundBrush, Pen forePen)
{
//draw minus
gr.FillRectangle(backgroundBrush, rectangle);
gr.DrawRectangle(pen, rectangle);
gr.DrawLine(forePen, rectangle.Left + 2, rectangle.Top + rectangle.Height / 2, rectangle.Right - 2, rectangle.Top + rectangle.Height / 2);
}
开发者ID:tsovince,项目名称:V_Library,代码行数:7,代码来源:VisualMarker.cs
示例7: Surface
public Surface()
{
ScreenRectangle = CaptureHelpers.GetScreenBounds();
ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle);
InitializeComponent();
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
DrawableObjects = new List<DrawableObject>();
Config = new SurfaceOptions();
timerStart = new Stopwatch();
timerFPS = new Stopwatch();
borderPen = new Pen(Color.Black);
borderDotPen = new Pen(Color.White);
borderDotPen.DashPattern = new float[] { 5, 5 };
nodeBackgroundBrush = new SolidBrush(Color.White);
textFont = new Font("Verdana", 16, FontStyle.Bold);
infoFont = new Font("Verdana", 9);
textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
markerPen = new Pen(Color.FromArgb(200, Color.Red)) { DashStyle = DashStyle.Dash };
}
开发者ID:andre-d,项目名称:ShareXYZ,代码行数:28,代码来源:Surface.cs
示例8: FillRoundRectangle
public static void FillRoundRectangle(Graphics g, Brush brush, Rectangle rect, int cornerRadius)
{
using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius))
{
g.FillPath(brush, path);
}
}
开发者ID:wawa0210,项目名称:jgq,代码行数:7,代码来源:ValidateCode.aspx.cs
示例9: Ellipse
public Ellipse(Pen pen, Brush brush, Point start, Point end)
{
Pen = pen;
Brush = brush;
Start = start;
End = end;
}
开发者ID:jsikorski,项目名称:dotnet-paint,代码行数:7,代码来源:Ellipse.cs
示例10: DrawRectangle
protected virtual void DrawRectangle(Pen outlinePen, Brush fillBrush)
{
if (fillBrush is LinearGradientBrush)
{
if ((rect.Width > 0) && (rect.Height > 0))
{
fillBrush = new LinearGradientBrush(rect,
args.settings.PrimaryColor,
args.settings.SecondaryColor,
args.settings.GradiantStyle);
//outlinePen = new Pen(fillBrush, args.settings.Width);
}
}
switch (args.settings.DrawMode)
{
case DrawMode.Outline:
g.DrawRectangle(outlinePen, rect);
break;
case DrawMode.Filled:
g.FillRectangle(fillBrush, rect);
break;
case DrawMode.Mixed:
g.FillRectangle(fillBrush, rect);
g.DrawRectangle(outlinePen, rect);
break;
case DrawMode.MixedWithSolidOutline:
g.FillRectangle(fillBrush, rect);
g.DrawRectangle(outlinePen, rect);
break;
}
}
开发者ID:mokacao,项目名称:Paint,代码行数:35,代码来源:RectangleTool.cs
示例11: NodeCursor
public NodeCursor(GameUI myGameUI, int myDepth)
: base(myGameUI, myDepth)
{
penCursorMini = new Pen(new SolidBrush(Color.FromArgb(180, Color.Wheat)), 2);
brushCellMarker = new SolidBrush(Color.FromArgb(40, Color.Yellow));
brushCursorMini = new SolidBrush(Color.FromArgb(200, Color.White));
}
开发者ID:rfrfrf,项目名称:SokoSolve-Sokoban,代码行数:7,代码来源:NodeCursor.cs
示例12: WatermarkFileWithText
public void WatermarkFileWithText(string inputFile, string outputFile, string text, Font font, int x, int y,
bool renderOver,
Brush under, Brush over, StringAlignment xAlignment,
StringAlignment yAlignment)
{
Image imgPhoto = null;
Image outputPhoto = null;
try
{
try
{
imgPhoto = Image.FromFile(inputFile);
}
catch (Exception ex)
{
throw new InvalidOperationException("Failed to open file \"" + inputFile + "\"", ex);
}
WatermarkImageWithText(imgPhoto, ref outputPhoto, SmoothingMode.AntiAlias, text, font, x, y, renderOver,
under, over, xAlignment, yAlignment);
imgPhoto.Dispose();
imgPhoto = null;
outputPhoto.Save(outputFile, ImageFormat.Jpeg);
}
finally
{
if (imgPhoto != null) imgPhoto.Dispose();
if (outputPhoto != null) outputPhoto.Dispose();
}
}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:32,代码来源:Watermarker.cs
示例13: BuildStatusMessageCellPainting
public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
{
if (revision.BuildStatus != null)
{
Brush buildStatusForebrush = foreBrush;
switch (revision.BuildStatus.Status)
{
case BuildInfo.BuildStatus.Success:
buildStatusForebrush = Brushes.DarkGreen;
break;
case BuildInfo.BuildStatus.Failure:
buildStatusForebrush = Brushes.DarkRed;
break;
case BuildInfo.BuildStatus.InProgress:
buildStatusForebrush = Brushes.Blue;
break;
case BuildInfo.BuildStatus.Unstable:
buildStatusForebrush = Brushes.OrangeRed;
break;
case BuildInfo.BuildStatus.Stopped:
buildStatusForebrush = Brushes.Gray;
break;
}
var text = (string)e.FormattedValue;
e.Graphics.DrawString(text, rowFont, buildStatusForebrush, new PointF(e.CellBounds.Left, e.CellBounds.Top + 4));
}
}
开发者ID:neoandrew1000,项目名称:gitextensions,代码行数:29,代码来源:BuildInfoDrawingLogic.cs
示例14: BuildStatusImageColumnCellPainting
public static void BuildStatusImageColumnCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
{
if (revision.BuildStatus != null)
{
Image buildStatusImage = null;
switch (revision.BuildStatus.Status)
{
case BuildInfo.BuildStatus.Success:
buildStatusImage = Resources.BuildSuccessful;
break;
case BuildInfo.BuildStatus.Failure:
buildStatusImage = Resources.BuildFailed;
break;
case BuildInfo.BuildStatus.Unknown:
buildStatusImage = Resources.BuildCancelled;
break;
case BuildInfo.BuildStatus.InProgress:
buildStatusImage = Resources.Icon_77;
break;
case BuildInfo.BuildStatus.Unstable:
buildStatusImage = Resources.bug;
break;
case BuildInfo.BuildStatus.Stopped:
buildStatusImage = Resources.BuildCancelled;
break;
}
if (buildStatusImage != null)
{
e.Graphics.DrawImage(buildStatusImage, new Rectangle(e.CellBounds.Left, e.CellBounds.Top + 4, 16, 16));
}
}
}
开发者ID:neoandrew1000,项目名称:gitextensions,代码行数:34,代码来源:BuildInfoDrawingLogic.cs
示例15: UpdateBackgroundBrush
/// ------------------------------------------------------------------------------------
/// <summary>
/// Updates the background brush.
/// </summary>
/// ------------------------------------------------------------------------------------
private void UpdateBackgroundBrush()
{
if (m_BackBrush != null)
m_BackBrush.Dispose();
m_BackBrush = null;
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:12,代码来源:ProgressLine.cs
示例16: SetPixelScaled
public void SetPixelScaled(int x, int y, Brush brush, int scale = 1)
{
int bitmapX = x * scale;
int bitmapY = y * scale;
FillRect(bitmapX, bitmapY, scale, scale, brush);
}
开发者ID:vlapchenko,项目名称:nfx,代码行数:7,代码来源:DrawingOutput.cs
示例17: FillPill
public static void FillPill(Brush b, RectangleF rect, Graphics g)
{
if (rect.Width > rect.Height)
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillEllipse(b, new RectangleF(rect.Left, rect.Top, rect.Height, rect.Height));
g.FillEllipse(b, new RectangleF(rect.Left + rect.Width - rect.Height, rect.Top, rect.Height, rect.Height));
var w = rect.Width - rect.Height;
var l = rect.Left + ((rect.Height) / 2);
g.FillRectangle(b, new RectangleF(l, rect.Top, w, rect.Height));
g.SmoothingMode = SmoothingMode.Default;
}
else if (rect.Width < rect.Height)
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillEllipse(b, new RectangleF(rect.Left, rect.Top, rect.Width, rect.Width));
g.FillEllipse(b, new RectangleF(rect.Left, rect.Top + rect.Height - rect.Width, rect.Width, rect.Width));
var t = rect.Top + (rect.Width / 2);
var h = rect.Height - rect.Width;
g.FillRectangle(b, new RectangleF(rect.Left, t, rect.Width, h));
g.SmoothingMode = SmoothingMode.Default;
}
else if (rect.Width == rect.Height)
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillEllipse(b, rect);
g.SmoothingMode = SmoothingMode.Default;
}
}
开发者ID:reward-hunters,项目名称:PrintAhead,代码行数:31,代码来源:TrackBarDrawingHelper.cs
示例18: DataPoint
public DataPoint(string name, float value, Brush brush)
{
m_name = name;
m_value = value;
m_brush = brush;
m_color = Color.Black;
}
开发者ID:krishnais,项目名称:ProfileSharp,代码行数:7,代码来源:DataPoint.cs
示例19: DoGraphics
protected void DoGraphics( ArrayList chains )
{
m_panelClip.Graphics.FillRectangle( Brushes.Black, m_panelClip.Rect );
int w = 350;
int h = 50;
m_backBrush = new SolidBrush( Color.FromArgb( 60, 60, 60 ) );
string[] prefix = new string[]{"LongMethod", "TemporaryField", "MessageChains"};
string[] baseCls = new string[]{"Detector", "Visualization", "Component", "Comparer"};
int i = 0;
MovieClip clip = m_panelClip.CreateSubMovieClip( 0, 0, w, h );
foreach( string bass in baseCls)
{
CreateClassHier( clip, bass, prefix, 0, 0, w/4, h );
i++;
}
MovieClip legend = clip.CreateSubMovieClip( (3*w)/4, 0, w/4, h );
Brush[] brushes = new Brush[]{Brushes.LightGreen,Brushes.LightBlue, Brushes.LightPink};
for( int d = 0; d < prefix.Length; d++ )
{ // extra spacing in between disconnected chains?
MovieClip index = legend.CreateSubMovieClip( 0, 0, w/4, h/3 );
MovieClip dot = index.CreateSubMovieClip( 0, 0, 10, 10 );
dot.Graphics.FillEllipse( brushes[d], 0, 0, 9, 9 );
MovieClip text = index.CreateSubMovieClip( 10, 0, w/4 - 10, h/3 );
text.LeftString( prefix[d], Brushes.White);
}
Space( 4, 1, legend.Children, w/4 );
Space( 10, 10, clip.Children, this.Width );
}
开发者ID:Robby777,项目名称:ambientsmell,代码行数:33,代码来源:ParallelInheritanceHierarchyVisualization.cs
示例20: VideoRender
public VideoRender(PictureBox view)
{
this.view = view;
this.bufferContext = BufferedGraphicsManager.Current;
this.foreground = new SolidBrush(Color.ForestGreen);
this.background = new SolidBrush(Color.Black);
}
开发者ID:fakeezz,项目名称:chip8.net,代码行数:7,代码来源:VideoRender.cs
注:本文中的System.Drawing.Brush类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论