Here are the examples of the csharp api class System.Windows.Forms.ControlPaint.DrawBorder3D(System.Drawing.Graphics, System.Drawing.Rectangle) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
1. Example
View licenseprotected override void OnPaint(PaintEventArgs e) { using (var brush = new LinearGradientBrush(base.Bounds, BackColor, BackColor2, GradientMode)) e.Graphics.FillRectangle(brush, base.Bounds); var r = new Rectangle(base.Bounds.X, base.Bounds.Y, base.Width - 1, base.Height - 1); if (BorderStyle == BorderStyle.FixedSingle) e.Graphics.DrawRectangle(SystemPens.WindowFrame, r); else if (BorderStyle == BorderStyle.Fixed3D) ControlPaint.DrawBorder3D(e.Graphics, r); }
0
2. Example
View licenseprotected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Graphics g = e.Graphics; var borderRect = new Rectangle(0, 0, Width, Height); if (Application.RenderWithVisualStyles) { TextBoxRenderer.DrawTextBox(g, borderRect, TextBoxState.Selected); } else { ControlPaint.DrawBorder3D(g, borderRect); g.FillRectangle(Brushes.White, new Rectangle(2, 2, Width - 4, Height - 4)); } g.TextRenderingHint = Drawing.TextRenderingHint; // Draw magnifying glass or cross icon Image image = textBox1.Text.Length > 0 && textBox1.Text != Messages.SEARCH_TEXT_BOX_INITIAL_TEXT ? Resources.cross : Resources._000_Search_h32bit_16; g.DrawImage(image, new Rectangle(textBox1.Width + textBox1.Left, Height / 2 - image.Height / 2, image.Width, image.Height)); }
0
3. Example
View licenseprotected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; float cx = this.ClientRectangle.Left + 10; float cy = this.ClientRectangle.Height / 2; float len = cy - 10; g.TranslateTransform(cx, cy); var pb = SystemBrushes.WindowText; for (float a = 0; a <= 180f; a += 15f) { var d = a * Math.PI / 180f; int x = (int)Math.Round(Math.Sin(d) * len); int y = (int)Math.Round(Math.Cos(d) * len); if ((a % 45) == 0) { g.FillPolygon(pb, new Point[] { new Point(x - 3, y), new Point(x, y - 4), new Point(x + 4, y), new Point(x, y + 4), }); } else { g.FillRectangle(pb, new Rectangle(x-1, y-1, 2, 2)); } } g.RotateTransform(-this.angle); SizeF textSize = new SizeF(0, 0); using (var sf = new StringFormat(StringFormat.GenericTypographic)) { sf.FormatFlags |= StringFormatFlags.NoWrap; textSize = g.MeasureString("Text", this.Font, 999999, sf); g.DrawString("Text", this.Font, SystemBrushes.WindowText, 0, -textSize.Height / 2, sf); } g.DrawLine(SystemPens.WindowText, textSize.Width + 5, 0, len - 7, 0); g.RotateTransform(this.angle); g.TranslateTransform(-cx, -cy); // border ControlPaint.DrawBorder3D(g, this.ClientRectangle); }