Advertisement
WannaFarm_YouTube

Rounded Form C# Script (Visual Studio 2019)

Aug 6th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. // I'll show you where to put some codes if you don't know.
  2. using System;
  3. using System.Windows.Forms;
  4. using System.Runtime.InteropServices;
  5.  
  6. namespace WindowsFormsApplication1
  7. {
  8.     public partial class Form1 : Form
  9.     {
  10.         [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] // This code goes up public Form1()
  11.         private static extern IntPtr CreateRoundRectRgn
  12.         (
  13.             int nLeftRect,     // x-coordinate of upper-left corner
  14.             int nTopRect,      // y-coordinate of upper-left corner
  15.             int nRightRect,    // x-coordinate of lower-right corner
  16.             int nBottomRect,   // y-coordinate of lower-right corner
  17.             int nWidthEllipse, // height of ellipse
  18.             int nHeightEllipse // width of ellipse
  19.         );
  20.  
  21.         public Form1()
  22.         {
  23.             InitializeComponent(); // You don't have to copy and paste this. It's not needed.
  24.             this.FormBorderStyle = FormBorderStyle.None; // this code goes under InitializeComponent();
  25.             Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement