PDA

View Full Version : سوال: گرد کردن گوشه های فرم



elahejafari
دوشنبه 13 آذر 1391, 08:08 صبح
سلام
چگونه می توان گوشه های یک فرم را گرد(حلالی) کرد؟

tooraj_azizi_1035
دوشنبه 13 آذر 1391, 09:22 صبح
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));
}
}
}

elahejafari
دوشنبه 13 آذر 1391, 13:59 عصر
دوست عزیز
از پاسخ شما ممنونم
وقنی کد فوق در UserControl اضافه می کنم و سپس اجرا می کنم گوشه های حلالی ایجاد می شود ولی گوشه های فبلی نیز باقی می ماند