Just know that your work is very appriciated, i used many of your tutorials on different projects trying to learn how to create windows applications. Definitly top tier design guides on the platform. Please continue to educate us on your designs!
Nice (la única palabra que se en inglés XD) PD: justo eso trataba de hacer y casi destruyo visual studio XD Siempre ayudando a la comunidad gracias bro
so awesome, however i cant understand how FormRegionAndBorder method work, wishing u can explain each line of code in this method on another video, love it !
@@VyrexVexy Hi, Source is the code as brought to us by RJ Code in bis video "Create Smooth Rounded Corners Form". In my example here I only worte down the modified parts.
Pretious as always... I appreciate your work so much. A good graphical UI is so helpful. How about integrating this Rounded Corners Form into your Custom Controls collection?
Is it possible to customize checkboxes in datagridview (datagridviewcheckboxcolumn) to have different symbols instead of tick for three states. State 1 with / State 2 with \ State 3 with x These will be good for ticking attendance / present in morning \ present in evening X present morning and evening.
Help, please. I try use your class component and fine, now i need to implement opacity property at this class component, when add this component marked with opacity property at form controls this component start blinking. Imports System.ComponentModel Imports System.Drawing.Drawing2D Public Class DkPanel Inherits Panel Private Const WS_EX_TRANSPARENT As Integer = &H20 Public Sub New() SetStyle(ControlStyles.Opaque, True) End Sub Public Sub New(con As IContainer) con.Add(Me) End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) Dim graph As Graphics = e.Graphics Using brush = New SolidBrush(Color.FromArgb(Opacity * 255 / 100, BackColor)) graph.FillRectangle(brush, ClientRectangle) End Using If BorderRadius > 1 Then Dim rectBorderSmooth = ClientRectangle Dim rectBorder = Rectangle.Inflate(rectBorderSmooth, -BorderSize, -BorderSize) Dim smoothSize As Integer = If(BorderSize > 0, BorderSize, 1) Using pathBorderSmooth As GraphicsPath = GetFigurePath(rectBorderSmooth, BorderRadius) Using pathBorder As GraphicsPath = GetFigurePath(rectBorder, BorderRadius - BorderSize) Using penBorderSmooth As Pen = New Pen(Parent.BackColor, smoothSize) Using penBorder As Pen = New Pen(BorderColor, BorderSize) Region = New Region(pathBorderSmooth) graph.SmoothingMode = SmoothingMode.AntiAlias penBorder.Alignment = System.Drawing.Drawing2D.PenAlignment.Center graph.DrawPath(penBorderSmooth, pathBorderSmooth) graph.DrawPath(penBorder, pathBorder) End Using End Using End Using End Using Else Using penBorder As Pen = New Pen(BorderColor, BorderSize) Region = New Region(ClientRectangle) penBorder.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset graph.DrawRectangle(penBorder, 0, 0, Width - 0.5F, Height - 0.5F) End Using End If End Sub Private Function GetFigurePath(ByVal rect As Rectangle, ByVal radius As Integer) As GraphicsPath Dim path As GraphicsPath = New GraphicsPath() Dim curveSize As Single = radius * 2.0F path.StartFigure() path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90) path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90) path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90) path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90) path.CloseFigure() Return path End Function 'Propertys Private _BorderColor As Color = Color.MediumSlateBlue Private _BorderSize As Integer = 1 Private _BorderRadius As Integer = 0
Public Property BorderColor As Color Get Return _BorderColor End Get Set(ByVal value As Color) _BorderColor = value Invalidate() End Set End Property
Public Property BorderSize As Integer Get Return _BorderSize End Get Set(ByVal value As Integer) If value >= 1 Then _BorderSize = value MyBase.Padding = New Padding(2, 2, 2, 2) Invalidate() Else _BorderSize = value MyBase.Padding = New Padding(0, 0, 0, 0) Invalidate() End If End Set End Property
Public Property BorderRadius As Integer Get Return _BorderRadius End Get Set(ByVal value As Integer) If value >= 0 Then _BorderRadius = value Invalidate() End If End Set End Property
Public Overrides Property BackColor As Color Get Return MyBase.BackColor End Get Set(ByVal value As Color) MyBase.BackColor = value Invalidate() End Set End Property
Public Overrides Property ForeColor As Color Get Return MyBase.ForeColor End Get Set(ByVal value As Color) MyBase.ForeColor = value End Set End Property
Public Overrides Property Font As Font Get Return MyBase.Font End Get Set(ByVal value As Font) MyBase.Font = value End Set End Property Private _Opacity As Integer = 100
Public Property Opacity() As Integer Get Return _Opacity End Get Set If Value < 0 OrElse Value > 100 Then Throw New ArgumentException("value must be between 0 and 100") ElseIf Value < 100 Then 'SetStyle(ControlStyles.Opaque, True) Else 'SetStyle(ControlStyles.Opaque, True) End If _Opacity = Value Invalidate() End Set End Property Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Dim cpar As CreateParams = MyBase.CreateParams cpar.ExStyle = cpar.ExStyle Or WS_EX_TRANSPARENT Return cpar End Get End Property End Class
Just know that your work is very appriciated, i used many of your tutorials on different projects trying to learn how to create windows applications. Definitly top tier design guides on the platform. Please continue to educate us on your designs!
Also thank you very much for watching my videos
Nice (la única palabra que se en inglés XD)
PD: justo eso trataba de hacer y casi destruyo visual studio XD
Siempre ayudando a la comunidad gracias bro
😅...XD, Igualmente gracias por mirar mis videos, el código fuente ya está disponible en la descripción del vídeo.
Thanks for the source code Mr.RJ Code | cool tutorial btw :D
You are my hero ! :) awesome job
Thanks ;)
great, this is what i was looking for
Great Tutorial...❤❤👍👍
Thanks Saurabh, the source code is already available in the video description.
so awesome, however i cant understand how FormRegionAndBorder method work, wishing u can explain each line of code in this method on another video, love it !
Excelente Tutorial
Gracias David, el código fuente ya está disponible en la descripción del vídeo.
فيديو حصري جدا جدا و مميز للغاية
you are talking about a rare subjects where always no answer for them in the network search
I tried some modifications . So I used the screen bitmap for the outer edge of the form. The result is - for me - a really satisfying outer edge of the Rounded Corner Form. But the solution for the inner side of the borderline could be even better.
Hope that nevertheless this will be helpful in some aspect (the code is written in C#9 on Visual Studio 2019).
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.RunTime.InteropServices;
using System.Windows.Forms;
namespace RoundedForm
{
public partial class Form1 : Form
{
// fields
private int borderSize = 2;
private int borderRadius = 30;
private Color borderColor = Color.Red;
private Bitmap fullScreenBitmap;
// constructor
public Form1()
{
InitializeComponent();
FormBorderStyle = FormBorderStyle.None;
Padding = new(borderSize);
}
#region DllImport
: (unchanged)
#endregion
// private methods
private void GetFullScreenBitmap()
{
Bitmap fullScreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
PixelFormat.Format32bppArgb);
Graphics graphics = Graphics.FromImage(fullScreen);
graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y,
0, 0,
Screen.PrimaryScreen.Bounds.Size,
CopyPixelOperation.SourceCopy);
fullScreenBitmap = fullScreen;
}
private void SetScreenAsFormBackground()
{
Rectangle sourceRect = new(Location.X, Location.Y, ClientRectangle.Width, ClientRectangle.Height);
BackgroundImage = (Image)fullScreenBitmap.Clone(sourceRect, fullScreenBitmap.PixelFormat);
}
private void PaintFormBackColor(Graphics graph)
{
Rectangle inflated = ClientRectangle;
inflated.Inflate(-borderSize - 1, -borderSize - 1);
GraphicsPath path = GetRoundedPath(inflated, borderRadius - borderSize);
graph.FillPath(new SolidBrush(BackColor), path);
Pen pen = new(BackColor, 1);
pen.Alignment = PenAlignment.Center;
graph.DrawPath(pen, path);
}
private GraphicsPath GetRoundedPath(Rectangle rect, float radius)
{
: (unchanged)
}
private void FormRegionAndBorder(Form form, float radius, Graphics graph,
Color borderColor, float borderSize)
{
: (unchanged)
}
// event handling
private void Form1_Load(object sender, EventArgs e)
{
GetFullScreenBitmap();
SetScreenAsFormBackground();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
PaintFormBackColor(e.Graphics);
}
Privat void Form1_Paint(object sender, PaintEventArgs e)
{
FormRegionAndBorder(this, borderRadius, e.Graphics, borderColor, borderSize);
}
private void Form1_ResizeEnd(object sender, EventArgs e)
{
SetScreenAsFormBackground();
}
// exit
private void BtnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
source ?
@@VyrexVexy Hi, Source is the code as brought to us by RJ Code in bis video "Create Smooth Rounded Corners Form". In my example here I only worte down the modified parts.
@@rudi4505 i mean the project 💀
THANK YOU SO MUCH DUDE
Hello, thanks for a good tutorial,
have a issue with border when mouse up event when move form.
I have update code to fix this issue
private bool dragging = false;
private Point startPoint = new Point(0, 0);
private void panelTitleBar_MouseDown(object sender, MouseEventArgs e)
{
//ReleaseCapture();
//SendMessage(this.Handle, 0x112, 0xf012, 0);
dragging = true;
startPoint = new Point(e.X, e.Y);
}
private void panelTitleBar_MouseMove(object sender, MouseEventArgs e)
{
if (dragging)
{
Point p = PointToScreen(e.Location);
Location = new Point(p.X - this.startPoint.X, p.Y - this.startPoint.Y);
}
}
private void panelTitleBar_MouseUp(object sender, MouseEventArgs e)
{
dragging = false;
}
Pretious as always... I appreciate your work so much. A good graphical UI is so helpful. How about integrating this Rounded Corners Form into your Custom Controls collection?
No problem, you can use the custom controls on this form just like any other.
may I ask what font are you using on Visual Studio? thanks
How do you make it so the rounded form can be made opaque / implement opacity?
How to beautify the scroll? Or divider? Thank you
good video. Can you make about custom scrollbar video. thank you
How to rotate a text box in a custom degree in a form or report? please
Is it possible to customize checkboxes in datagridview (datagridviewcheckboxcolumn) to have different symbols instead of tick for three states.
State 1 with /
State 2 with \
State 3 with x
These will be good for ticking attendance
/ present in morning
\ present in evening
X present morning and evening.
Is it ok if i call you Bill gates.... I am just saying I really appreciate what you do. you are the best of the best
Hi man, whats visual studio theme you have here?
or what you font have :>
For Multiple Forms?
Lástima que soy tan tonto y no puedo hacerlo, que bueno seria descargar la fuente :((((((((((((((
El código está en la descripción del vídeo.
It doesn't look good front of a white page.
21 минуту ты делал этот изич, он делается в 2 минуты
Help, please. I try use your class component and fine, now i need to implement opacity property at this class component, when add this component marked with opacity property at form controls this component start blinking.
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Public Class DkPanel
Inherits Panel
Private Const WS_EX_TRANSPARENT As Integer = &H20
Public Sub New()
SetStyle(ControlStyles.Opaque, True)
End Sub
Public Sub New(con As IContainer)
con.Add(Me)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim graph As Graphics = e.Graphics
Using brush = New SolidBrush(Color.FromArgb(Opacity * 255 / 100, BackColor))
graph.FillRectangle(brush, ClientRectangle)
End Using
If BorderRadius > 1 Then
Dim rectBorderSmooth = ClientRectangle
Dim rectBorder = Rectangle.Inflate(rectBorderSmooth, -BorderSize, -BorderSize)
Dim smoothSize As Integer = If(BorderSize > 0, BorderSize, 1)
Using pathBorderSmooth As GraphicsPath = GetFigurePath(rectBorderSmooth, BorderRadius)
Using pathBorder As GraphicsPath = GetFigurePath(rectBorder, BorderRadius - BorderSize)
Using penBorderSmooth As Pen = New Pen(Parent.BackColor, smoothSize)
Using penBorder As Pen = New Pen(BorderColor, BorderSize)
Region = New Region(pathBorderSmooth)
graph.SmoothingMode = SmoothingMode.AntiAlias
penBorder.Alignment = System.Drawing.Drawing2D.PenAlignment.Center
graph.DrawPath(penBorderSmooth, pathBorderSmooth)
graph.DrawPath(penBorder, pathBorder)
End Using
End Using
End Using
End Using
Else
Using penBorder As Pen = New Pen(BorderColor, BorderSize)
Region = New Region(ClientRectangle)
penBorder.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset
graph.DrawRectangle(penBorder, 0, 0, Width - 0.5F, Height - 0.5F)
End Using
End If
End Sub
Private Function GetFigurePath(ByVal rect As Rectangle, ByVal radius As Integer) As GraphicsPath
Dim path As GraphicsPath = New GraphicsPath()
Dim curveSize As Single = radius * 2.0F
path.StartFigure()
path.AddArc(rect.X, rect.Y, curveSize, curveSize, 180, 90)
path.AddArc(rect.Right - curveSize, rect.Y, curveSize, curveSize, 270, 90)
path.AddArc(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize, 0, 90)
path.AddArc(rect.X, rect.Bottom - curveSize, curveSize, curveSize, 90, 90)
path.CloseFigure()
Return path
End Function
'Propertys
Private _BorderColor As Color = Color.MediumSlateBlue
Private _BorderSize As Integer = 1
Private _BorderRadius As Integer = 0
Public Property BorderColor As Color
Get
Return _BorderColor
End Get
Set(ByVal value As Color)
_BorderColor = value
Invalidate()
End Set
End Property
Public Property BorderSize As Integer
Get
Return _BorderSize
End Get
Set(ByVal value As Integer)
If value >= 1 Then
_BorderSize = value
MyBase.Padding = New Padding(2, 2, 2, 2)
Invalidate()
Else
_BorderSize = value
MyBase.Padding = New Padding(0, 0, 0, 0)
Invalidate()
End If
End Set
End Property
Public Property BorderRadius As Integer
Get
Return _BorderRadius
End Get
Set(ByVal value As Integer)
If value >= 0 Then
_BorderRadius = value
Invalidate()
End If
End Set
End Property
Public Overrides Property BackColor As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal value As Color)
MyBase.BackColor = value
Invalidate()
End Set
End Property
Public Overrides Property ForeColor As Color
Get
Return MyBase.ForeColor
End Get
Set(ByVal value As Color)
MyBase.ForeColor = value
End Set
End Property
Public Overrides Property Font As Font
Get
Return MyBase.Font
End Get
Set(ByVal value As Font)
MyBase.Font = value
End Set
End Property
Private _Opacity As Integer = 100
Public Property Opacity() As Integer
Get
Return _Opacity
End Get
Set
If Value < 0 OrElse Value > 100 Then
Throw New ArgumentException("value must be between 0 and 100")
ElseIf Value < 100 Then
'SetStyle(ControlStyles.Opaque, True)
Else
'SetStyle(ControlStyles.Opaque, True)
End If
_Opacity = Value
Invalidate()
End Set
End Property
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cpar As CreateParams = MyBase.CreateParams
cpar.ExStyle = cpar.ExStyle Or WS_EX_TRANSPARENT
Return cpar
End Get
End Property
End Class