/// <summary> /// Draws a point (a 1x1 rectangle) in the drawing surface. (this is the method that performs the job /// </summary> /// <param name="x">The x coordinates of the point.</param> /// <param name="y">The y coordinates of the point.</param> /// <param name="color">The color of the point.</param> public void Point(float x, float y, System.Drawing.Brush color) { int w = this.X2W(x) & 536870911; int h = this.Y2H(y) & 536870911; this.Graphics.FillRectangle(color, w, h, 1, 1); }
private void DrawRectPanel(System.Windows.Forms.PaintEventArgs pevent) { if ((_GradientMode == Oranikle.Studio.Controls.StyledPanel_LinearGradientMode.None) || BackColor == _BackColour2) { pevent.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Invalid; pevent.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low; pevent.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; pevent.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; } else { pevent.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; pevent.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; pevent.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; pevent.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; } System.Drawing.Brush brush = GetBackgroundBrush(pevent); pevent.Graphics.FillRectangle(brush, ClientRectangle); brush.Dispose(); if ((_BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle) && (_BorderWidth > 0)) { System.Drawing.Pen pen = GetBorderPen(_BorderColour, _BorderWidth); System.Drawing.Rectangle rectangle2 = ClientRectangle; System.Drawing.Point point = rectangle2.Location; point.X += _BorderWidth / 2; point.Y += _BorderWidth / 2; System.Drawing.Rectangle rectangle3 = ClientRectangle; System.Drawing.Size size = rectangle3.Size; size.Width -= _BorderWidth; size.Height -= _BorderWidth; System.Drawing.Rectangle rectangle1 = new System.Drawing.Rectangle(point, size); pevent.Graphics.DrawRectangle(pen, rectangle1); pen.Dispose(); } }
private BrushParam BrushParamFromGDIBrush(System.Drawing.Brush brush) { if (brush is System.Drawing.Drawing2D.LinearGradientBrush) { LinearGradientBrushParam parm = new LinearGradientBrushParam(); System.Drawing.Drawing2D.LinearGradientBrush linear = (System.Drawing.Drawing2D.LinearGradientBrush)brush; parm.prop.StartPoint = new RawVector2(linear.Rectangle.Left, linear.Rectangle.Top); parm.prop.EndPoint = new RawVector2(linear.Rectangle.Right, linear.Rectangle.Bottom); parm.stops = new GradientStop[linear.InterpolationColors.Colors.Length]; for (int i = 0; i < parm.stops.Length; ++i) { parm.stops[i].Color = ToRawColor4(linear.InterpolationColors.Colors[i]); parm.stops[i].Position = linear.InterpolationColors.Positions[i]; } parm.Parent = this; return(parm); } else if (brush is System.Drawing.SolidBrush) { System.Drawing.SolidBrush solid = (System.Drawing.SolidBrush)brush; SolidBrushParam solidParm = new SolidBrushParam(); solidParm.Parent = this; solidParm.Color = solid.Color.ToArgb(); return(solidParm); } else { SolidBrushParam solidParm = new SolidBrushParam(); solidParm.Parent = this; solidParm.Color = 0; return(solidParm); } }
public static System.Drawing.Image DrawHatchRectangleToImg(int iLegendPattern, System.Drawing.Color colFC, System.Drawing.Color colHB, System.Drawing.Color colHL) { int iBulletSize = 20; System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(iBulletSize, iBulletSize); using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp)) { g.Clear(System.Drawing.Color.White); // Add legend rectangle with color using (System.Drawing.Brush CurrentBrush = GetBrush(iLegendPattern, colFC, colHB, colHL)) { System.Drawing.Rectangle rect2 = new System.Drawing.Rectangle(0, 0, iBulletSize, iBulletSize); if (CurrentBrush != null) { //if (object.ReferenceEquals(CurrentBrush, typeof(TextureBrush))) if (CurrentBrush is System.Drawing.TextureBrush) { ((System.Drawing.TextureBrush)CurrentBrush).TranslateTransform(rect2.X, rect2.Y); } // Punkt - Quadrat g.FillRectangle(CurrentBrush, rect2); // cDrawingTools.FillTriangle(g, CurrentBrush, iOriginX, iOriginY, i, iBulletSize); // cDrawingTools.FillCircle(g, CurrentBrush, iOriginX + iBulletSize / 2.0f, iOriginY + i * (iBulletSize * 2) + iBulletSize / 2.0f, iBulletSize / 2.0f); } // End if (CurrentBrush != null) } // End Using System.Drawing.Brush CurrentBrush } return(bmp); } // End Sub
protected PathControlPoint(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { _path = BinarySerializer.DeserializePath((byte[])info.GetValue(SerializationNames.Path, typeof(byte[]))); _pen = BinarySerializer.DeserializePen((byte[])info.GetValue(SerializationNames.Pen, typeof(byte[]))); _brush = BinarySerializer.DeserializeBrush((byte[])info.GetValue(SerializationNames.Brush, typeof(byte[]))); _size = (System.Drawing.Size)info.GetValue(SerializationNames.ControlPointSize, typeof(System.Drawing.Size)); }
private void AddArea(Point basePoint, Size size, Brush brush, Color color, System.Drawing.Brush gdiBrush) { var area = new Area(); // 頂点を設定する var points = new PointCollection(); points.Add(basePoint); points.Add(new Point( basePoint.X + 4, basePoint.Y + 4 + size.Height )); points.Add(new Point( basePoint.X + 8 + size.Width, basePoint.Y + 8 + size.Height )); points.Add(new Point( basePoint.X + 4 + size.Width, basePoint.Y + 4 )); area.Points = points; // 色を設定する area.FillBrush = brush; area.FillColor = color; area.FillGdiBrush = gdiBrush; _areas.Add(area); }
public void draw(System.Drawing.Graphics g, int scale, bool drawTeleArrows) { if (b == null) { return; } lock (drawLock) { b.draw(g, scale, drawTeleArrows); HashSet <Board.Position> pps = new HashSet <Board.Position>(); foreach (Specimen s in specimens) { Board.Position p = s.pos; if (pps.Contains(p)) { continue; } pps.Add(p); System.Drawing.Brush brsh = consts.specimenBrush; // too much fun //brsh = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 0, 255 - (int)(255.0 / (1.0 + (double)s.fitness / 50.0)), 100)); g.FillRectangle(brsh, p.x * scale + 1, p.y * scale + 1, scale - 2, scale - 2); } } }
public override void FillRectangle(Chaos.Image.RawColor color, Chaos.Util.Mathematics.RectangleF rect) { using (System.Drawing.Brush brush2 = CreateBrush(color)) { InternalGraphics.FillRectangle(brush2, rect.Convert()); } }
public TestObject(string name, int value, System.Drawing.Brush color, int[] series) { _name = name; _numbers = series; _color = color; _value = value; }
public void FillRectangles(System.Drawing.Brush brush, System.Drawing.RectangleF[] rects) { foreach (var rect in rects) { FillRectangle(brush, rect); } }
private void listChars_DrawItem(object sender, System.Windows.Forms.DrawListViewItemEventArgs e) { if ((e.State & (ListViewItemStates.Selected | ListViewItemStates.Hot)) != 0) { e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Highlight, e.Bounds); } else { e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Info, e.Bounds); } e.Graphics.DrawRectangle(System.Drawing.Pens.Black, e.Bounds); Types.C64Character character = (Types.C64Character)e.Item.Tag; if (character == null) { return; } System.Drawing.Brush brush = System.Drawing.SystemBrushes.WindowText; if ((e.State & (ListViewItemStates.Selected | ListViewItemStates.Hot)) != 0) { brush = System.Drawing.SystemBrushes.HighlightText; } e.Graphics.DrawString(e.Item.Text, listChars.Font, brush, new System.Drawing.PointF(e.Bounds.Left + 2, e.Bounds.Top + 2)); e.Graphics.DrawString(character.PetSCIIValue.ToString("X02"), _DefaultFont, brush, new System.Drawing.PointF(e.Bounds.Left + 40, e.Bounds.Top + 2)); e.Graphics.DrawString(character.Desc, _DefaultFont, brush, new System.Drawing.PointF(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height * 0.5f)); if ((e.State & ListViewItemStates.Focused) != 0) { e.DrawFocusRectangle(); } }
public void EventAllConfigsLB_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { System.Windows.Forms.ListBox _ListBox = (System.Windows.Forms.ListBox)sender; e.DrawBackground(); System.Drawing.Brush myBrush = System.Drawing.Brushes.White; string currentItem = _ListBox.Items[e.Index].ToString(); if (_ListBox.SelectedIndex != e.Index)//e.State != System.Windows.Forms.DrawItemState.Selected)// { string currItemValue = currentItem.Split('=').Last(); if (currItemValue == "enabled") { myBrush = System.Drawing.Brushes.DarkGreen; } else if (currItemValue == "disabled") { myBrush = System.Drawing.Brushes.DarkRed; } else// if (currItemValue == "enabled(auto)") { myBrush = System.Drawing.Brushes.Black; } } e.Graphics.DrawString(currentItem, e.Font, myBrush, e.Bounds, System.Drawing.StringFormat.GenericDefault); }
public RoomLocation(System.Drawing.Point point, int level, System.Drawing.Pen pen, System.Drawing.Brush brush) { Location = point; RoomColor = pen; SecondaryColor = brush; Level = level; }
public PlottablePolygon(double[] xs, double[] ys, string label, double lineWidth, System.Drawing.Color lineColor, bool fill, System.Drawing.Color fillColor, double fillAlpha) { if (xs is null || ys is null) { throw new ArgumentException("xs and ys cannot be null"); } if (xs.Length != ys.Length) { throw new ArgumentException("xs and ys must have the same number of elements"); } if (xs.Length < 3) { throw new ArgumentException("polygons must contain at least 3 points"); } this.xs = xs; this.ys = ys; this.label = label; this.lineWidth = lineWidth; this.lineColor = lineColor; this.fill = fill; pen = new System.Drawing.Pen(lineColor, (float)lineWidth) { LineJoin = System.Drawing.Drawing2D.LineJoin.Round, // prevent sharp corners }; this.fillColor = System.Drawing.Color.FromArgb((int)(255 * fillAlpha), fillColor.R, fillColor.G, fillColor.B); brush = new System.Drawing.SolidBrush(this.fillColor); }
void BuildFontSheetBitmap(System.Drawing.Font font, System.Drawing.Graphics charGraphics, System.Drawing.Bitmap charBitmap, System.Drawing.Graphics fontSheetGraphics) { System.Drawing.Brush whiteBrush = System.Drawing.Brushes.White; int fontSheetX = 0; int fontSheetY = 0; for (int i = 0; i < NumChars; ++i) { charGraphics.Clear(System.Drawing.Color.FromArgb(0, System.Drawing.Color.Black)); charGraphics.DrawString(((char)(StartChar + i)).ToString(), font, whiteBrush, new System.Drawing.PointF(0.0f, 0.0f)); int minX = GetCharMinX(charBitmap); int maxX = GetCharMaxX(charBitmap); int charWidth = maxX - minX + 1; if (fontSheetX + charWidth >= _texWidth) { fontSheetX = 0; fontSheetY += (int)(_charHeight) + 1; } _charRects[i] = new Rectangle(fontSheetX, fontSheetY, charWidth, _charHeight); fontSheetGraphics.DrawImage(charBitmap, fontSheetX, fontSheetY, new System.Drawing.Rectangle(minX, 0, charWidth, _charHeight), System.Drawing.GraphicsUnit.Pixel); fontSheetX += charWidth + 1; } }
public override void FillCircle(RawColor color, Vector2f center, float radius) { using (System.Drawing.Brush brush2 = CreateBrush(color)) { InternalGraphics.FillEllipse(brush2, center.X - radius, center.Y - radius, radius * 2, radius * 2); } }
private void Initialize() { this.Font = new System.Drawing.Font("MS ゴシック", 9); this.brush = System.Drawing.Brushes.Black; this.strPosition = new System.Drawing.PointF(0, 0); this.format = new System.Drawing.StringFormat(); }
/// <summary> /// Draw the highlighted cells. /// </summary> /// <param name="graphics"></param> /// <param name="drawingRange">The range of cells that must be redrawed. Consider that can contains also not selected cells.</param> protected virtual void DrawHighlight(DevAge.Drawing.GraphicsCache graphics, Range drawingRange) { if (Region.IsEmpty() || Region.IntersectsWith(drawingRange) == false) { return; } System.Drawing.Brush brush = graphics.BrushsCache.GetBrush(BackColor); foreach (Range rng in Region.GetRanges()) { System.Drawing.Rectangle rectToDraw = Grid.RangeToRectangle(rng); if (rectToDraw == System.Drawing.Rectangle.Empty) { continue; } System.Drawing.RectangleF contentRect = Border.GetContentRectangle(rectToDraw); graphics.Graphics.FillRectangle(brush, contentRect); Border.Draw(graphics, rectToDraw); } }
} // End Sub SaveImage public void SetFont(string strFontName, System.Drawing.FontStyle fsFontStyle, int iFontSize, System.Drawing.Color cTextColor) { TextFont = new System.Drawing.Font(strFontName, iFontSize, fsFontStyle, System.Drawing.GraphicsUnit.Point); TextColor = cTextColor; //Color.Black TextBrush = new System.Drawing.SolidBrush(TextColor); } // End Sub SetFont
public TextCord(string st, float x, float y, System.Drawing.Font f, System.Drawing.Brush b) { X = x; Y = y; font = f; brush = b; str = st; }
public void Reset() { timePassed = 0; CurrentState = State.None; brushGreen = System.Drawing.Brushes.White; brushYellow = System.Drawing.Brushes.White; brushRed = System.Drawing.Brushes.White; }
private void drawHeap(System.Drawing.Graphics g, System.Drawing.Brush br, IEnumerable <System.Drawing.Point> list) { foreach (var i in list) { g.FillRectangle(br, i.X, i.Y, tetris.Properties.Settings.Default.SizeItem, tetris.Properties.Settings.Default.SizeItem); } }
public System.Drawing.Brush getColorKeyBrush() { if (brush == null) { brush = (new System.Drawing.Pen(getColorKey())).Brush; } return(brush); }
public MedAxis(System.Drawing.Font font, System.Drawing.Brush brush, float max, float min, float step) { _font = font; _max = max; _min = min; _step = step; _brush = brush; }
private System.Drawing.SolidBrush InterpolateBrush(System.Drawing.Brush min, System.Drawing.Brush max, double attr) { if (min.GetType() != typeof(System.Drawing.SolidBrush) || max.GetType() != typeof(System.Drawing.SolidBrush)) { throw (new ArgumentException("Only SolidBrush brushes are supported in GradientTheme")); } return(new System.Drawing.SolidBrush(InterpolateColor((min as System.Drawing.SolidBrush).Color, (max as System.Drawing.SolidBrush).Color, attr))); }
public TextCord(string st, float x, float y, System.Drawing.Font f, System.Drawing.Brush b) { X = x; Y = y; font = f; brush = b; str = st; }
public void Draw(System.Drawing.Graphics g, System.Drawing.Brush b, Ratchet.Math.mat4 model, Ratchet.Math.mat4 view, Ratchet.Math.mat4 projection) { _1.Draw(g, b, model, view, projection); _2.Draw(g, b, model, view, projection); _3.Draw(g, b, model, view, projection); _4.Draw(g, b, model, view, projection); _5.Draw(g, b, model, view, projection); _6.Draw(g, b, model, view, projection); }
int GetColorFromBrush(System.Drawing.Brush brush) { int color = System.Drawing.Color.Black.ToArgb(); if (brush is System.Drawing.SolidBrush) { color = (brush as System.Drawing.SolidBrush).Color.ToArgb(); } return(color); }
//TODO add this to DrawLines. private static void DrawPoints(System.Drawing.Graphics graphics, System.Drawing.Brush pointBrush, System.Drawing.PointF[] points, float radius) { float diameter = radius + radius; for (int i = 0; i < points.Length; i++) { System.Drawing.PointF point = points[i]; graphics.FillEllipse(pointBrush, point.X - radius, point.Y - radius, diameter, diameter); } }
public override void DrawString(string text, CommonGui.Drawing.Font font, Chaos.Image.RawColor color, Vector2f position) { using (System.Drawing.Font font2 = CreateFont(font)) { using (System.Drawing.Brush brush = CreateBrush(color)) { InternalGraphics.DrawString(text, font2, brush, new System.Drawing.PointF(position.X, position.Y)); } } }
public Trafficlight(int x, int y, int position) : base(x, y) { this.CurrentState = State.None; this.GreenSeconds = 2; this.YellowSeconds = 1; this.Position = position; brushGreen = System.Drawing.Brushes.White; brushYellow = System.Drawing.Brushes.White; brushRed = System.Drawing.Brushes.White; }
private void Window_Load(object sender, EventArgs e) { myBrush = new System.Drawing.SolidBrush(listBoxValid.ForeColor); InitDevice(); directControl.Render = this.RenderScene; string dxsdkdir = Environment.GetEnvironmentVariable("DXSDK_DIR"); if (!string.IsNullOrEmpty(dxsdkdir)) openFileDialog1.InitialDirectory = System.IO.Path.Combine(dxsdkdir, "Samples\\Media"); if (File.Exists("knownFiles.xml")) LoadKnown(); else { knownFiles = new XDocument( new XElement("KnownFiles", new XElement("Valid"), new XElement("Invalid"))); SaveKnown(); } }
public PublicTransportTheme(System.Drawing.Brush brush) { _brush = brush; }