Professional Documents
Culture Documents
Circular Picture Box - Border Gradient Color + Styles - C # & WinForms - RJ Code Advance
Circular Picture Box - Border Gradient Color + Styles - C # & WinForms - RJ Code Advance
Circular Picture Box - Border Gradient Color + Styles - C # & WinForms - RJ Code Advance
Website Automation
10 Buổi Zoom về Website Automation - Bí Quyết Tặng Doanh Số Trê
UltraMailer.vn
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 1/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
Hello, now we will create a circular picture box with a border gradient color, with various
types of line style, for example; solid, dashes, dots, combined between dashes and dots, or
just no border. Also to be able to set the cover style at the end or beginning of a script, for
example, a flat, rounded or triangular style.
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 2/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
// Fields
private int borderSize = 2 ;
private Color borderColor = Color. RoyalBlue ;
private Color borderColor2 = Color. HotPink ;
private DashStyle borderLineStyle = DashStyle. Solid ;
private DashCap borderCapStyle = DashCap. Flat ;
private float gradientAngle = 50F;
5.- Builder
In the constructor, just set the height and width to the same size. And optionally set the size
mode, in this case, I will indicate the image to fit the size of the image box.
//Builder
public RJCircularPictureBox ()
{
this . Size = new Size ( 100 , 100 ) ;
this . SizeMode = PictureBoxSizeMode. StretchImage ;
}
// Properties
[ Category ( "RJ Code Advance" )]
public int BorderSize
{
get { return borderSize; }
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 3/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
set
{
borderSize = value ;
this . Invalidate () ;
}
}
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 4/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
}
}
// Overridden methods
protected override void OnResize ( EventArgs e )
{
base . OnResize ( e ) ;
this . Size = new Size ( this . Width , this . Width ) ;
}
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 5/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
// Drawing
graph. DrawEllipse ( penSmooth, rectContourSmooth ) ; // Draw con
if ( borderSize > 0 ) // Draw border
graph. DrawEllipse ( penBorder, rectBorder ) ;
}
}
Video-tutorial
Circular Picture Box - Gradient color border, Line & Cap Styles | C# & WinForms
Leave a reply
Your email address will not be published. Required fields are marked with *
Commentary
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 6/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
Name *
E-mail *
Web
Welcome to blog
Look for …
Follow me
Category:
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 7/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
.NET
ASP .NET
C#
Mistakes
F#
Visual basic
Windows Forms
Layered Architecture
Database
MySQL
SQL Server
Custom controls
courses
.NET (Course)
Create .Net Installer
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 8/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
Recent logins
Circular Picture Box - Border Gradient color + Styles - C # & WinForms
Custom ProgressBar - WinForms & C #
Custom TextBox Full - Rounded & Placeholder - WinForm, C #
Custom ComboBox - Icon, Back, Text & Border Color - WinForm C #
Custom Text Box - Custom controls WinForm C #
Recent comments
gustavo on Custom Button - Custom controls WinForm C #
_Nooker in Modern Form + Font Awesome Icons, WinForm, C # - VB.NET
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 9/10
7/22/2021 Circular Picture Box - Border Gradient color + Styles - C # & WinForms - RJ Code Advance
https://rjcodeadvance.com/circular-picture-box-border-gradient-color-styles-c-winforms/ 10/10