protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { if (this.backgroundImage != null) { this.graphics.BeginRender(this.backgroundImage); } else { this.graphics.BeginRender(D2DColor.FromGDIColor(this.BackColor)); } OnRender(this.graphics); if (ShowFPS) { if (this.lastFpsUpdate.Second != DateTime.Now.Second) { this.lastFps = this.currentFps; this.currentFps = 0; } else { this.currentFps++; } string info = string.Format("{0} fps", this.lastFps); System.Drawing.SizeF size = e.Graphics.MeasureString(info, Font, Width); e.Graphics.DrawString(info, Font, System.Drawing.Brushes.Black, ClientRectangle.Right - size.Width - 10, 5); } this.graphics.EndRender(); }
public override void OnPaint() { bg.BeginRender(); bg.FillRectangle(Location.X, Location.Y, Size.Width, Size.Height, D2DColor.FromGDIColor(BackColor)); bg.FillRectangle(Location.X + 5, Location.Y + 55, Size.Width - 10, Size.Height - 60, D2DColor.FromGDIColor(BackColor2)); bg.DrawText(this.Name, D2DColor.FromGDIColor(Color.FromArgb(230, 247, 243, 243)), new Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point), Location.X + 10, Location.Y + 10); bg.EndRender(); }
public void DrawPolygon(PointF[] ps, Color strokeColor, float weight, Color fillColor) { D2DPoint[] pt = new D2DPoint[ps.Length]; for (int i = 0; i < ps.Length; i++) { pt[i] = new D2DPoint(ps[i].X, ps[i].Y); } this.g.DrawPolygon(pt, D2DColor.FromGDIColor(strokeColor), weight, D2DDashStyle.Solid, D2DColor.FromGDIColor(fillColor)); }
protected override void OnRender(D2DGraphics g) { base.OnRender(g); foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderBy(s => s.Item2)) { nanoD2d.bg?.BeginRender(); nanoD2d.bg?.Clear(D2DColor.Transparent); nanoD2d.bg?.EndRender(); } count++; label7.Text = count.ToString(); foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderBy(s => s.Item2)) { if (index != 0) { nanoD2d.OnPaint(new Point(0, 0)); } else { nanoD2d.OnPaint(new Point(0, 0)); } } foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderByDescending(s => s.Item2)) { if (index != 0) { var rect = new D2DRect(nanoD2d.Location.X, nanoD2d.Location.Y, nanoD2d.Size.Width, nanoD2d.Size.Height); nanoD2d.Parent?.bg?.BeginRender(); nanoD2d.Parent?.bg?.DrawBitmap(nanoD2d.bg, rect); nanoD2d.Parent?.bg?.EndRender(); } } foreach (var nanoD2d in controls.Reverse()) { nanoD2d.OnRender(g); } if (selectControl != null) { var tmpRect1 = new D2DRect(selectControl.AbsolutePosition.X, selectControl.AbsolutePosition.Y, selectControl.Size.Width, selectControl.Size.Height); g.FillRectangle(tmpRect1, D2DColor.FromGDIColor(Color.FromArgb(80, 0, 0, 255))); } }
public override void OnPaint() { bg.BeginRender(); bg.FillRectangle(0, 0, this.Size.Width, this.Size.Height, D2DColor.FromGDIColor(Color.FromArgb(230, 225, 225, 225))); for (var i = 15; i < gitColor.Count; i++) { for (var j = 0; j < gitColor[i].Count; j++) { bg.FillRectangle(13 * (i - 15) + 3, 13 * j + 3, 10, 10, D2DColor.FromGDIColor(gitColor[i][j])); } } isRender = false; bg.EndRender(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { if (this.DesignMode) { e.Graphics.Clear(System.Drawing.Color.Black); e.Graphics.DrawString("D2DLib windows form cannot render in design time.", this.Font, System.Drawing.Brushes.White, 10, 10); } else { if (this.backgroundImage != null) { this.graphics.BeginRender(this.backgroundImage); } else { this.graphics.BeginRender(D2DColor.FromGDIColor(this.BackColor)); } OnRender(this.graphics); if (ShowFPS) { if (this.lastFpsUpdate.Second != DateTime.Now.Second) { this.lastFps = this.currentFps; this.currentFps = 0; this.lastFpsUpdate = DateTime.Now; } else { this.currentFps++; } string fpsInfo = string.Format("{0} fps", lastFps); System.Drawing.SizeF size = e.Graphics.MeasureString(fpsInfo, Font, Width); this.graphics.DrawText(fpsInfo, unvell.D2DLib.D2DColor.Silver, Font, new System.Drawing.PointF(ClientRectangle.Right - size.Width - 10, 5)); } this.graphics.EndRender(); if ((this.animationDraw || this.sceneAnimation) && !this.timer.Enabled) { this.timer.Start(); } } }
protected override void OnPaint(PaintEventArgs e) { if (HardwardAcceleration) { this.DoubleBuffered = false; if (this.d2dGraphics == null) { this.d2dGraphics = new Direct2DGraphics(this.graphics); } else { this.d2dGraphics.g = this.graphics; } this.graphics.BeginRender(D2DColor.FromGDIColor(this.BackColor)); this.OnDraw(this.d2dGraphics); this.graphics.EndRender(); } else { this.DoubleBuffered = true; if (this.gdiGraphics == null) { this.gdiGraphics = new GDIGraphics(e.Graphics); } else { this.gdiGraphics.g = e.Graphics; } this.OnDraw(this.gdiGraphics); } }
public void DrawString(string text, Font font, Color c, float x, float y) { this.g.DrawText(text, D2DColor.FromGDIColor(c), font, x, y); }
public void FillEllipse(float x, float y, float w, float h, Color c) { this.g.FillEllipse(x, y, w, h, D2DColor.FromGDIColor(c)); }
public void DrawEllipse(float x, float y, float w, float h, Color c, float weight = 1f) { this.g.DrawEllipse(x, y, w, h, D2DColor.FromGDIColor(c), weight); }
public void FillRectangle(float x, float y, float w, float h, Color c) { this.g.FillRectangle(new D2DRect(x, y, w, h), D2DColor.FromGDIColor(c)); }
public void DrawLine(float x1, float y1, float x2, float y2, Color c, float weight = 1f) { this.g.DrawLine(x1, y1, x2, y2, D2DColor.FromGDIColor(c), weight); }
public override void OnPaint(Point offSet) { bg.BeginRender(); bg.FillRectangle(offSet.X, offSet.Y, Size.Width, Size.Height, D2DColor.FromGDIColor(BackColor)); bg.EndRender(); }
public override void OnPaint() { bg.BeginRender(); bg.FillRectangle(Location.X, Location.Y, Size.Width, Size.Height, D2DColor.FromGDIColor(BackColor)); bg.EndRender(); }