x32x01
  • by x32x01 ||
Rounded Corners in C# Windows Forms
C#:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
        private static extern IntPtr CreateRoundRectRgn
        (
            int nLeftRect,     // x-coordinate of upper-left corner
            int nTopRect,      // y-coordinate of upper-left corner
            int nRightRect,    // x-coordinate of lower-right corner
            int nBottomRect,   // y-coordinate of lower-right corner
            int nWidthEllipse, // height of ellipse
            int nHeightEllipse // width of ellipse
        );

        public Form1()
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.None;
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
        }
    }
}
 

Similar Threads

x32x01
Replies
0
Views
92
x32x01
x32x01
x32x01
Replies
0
Views
170
x32x01
x32x01
x32x01
Replies
0
Views
594
x32x01
x32x01
x32x01
Replies
0
Views
282
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
236
x32x01
x32x01
TAGs: Tags
c# code c# windows forms

Register & Login Faster

Forgot your password?

Latest Resources

Forum Statistics

Threads
517
Messages
518
Members
45
Latest Member
Tacola
Back
Top