با زدن دکمه F7 به محیط کدنویسی برین و در بالای سازنده فرم کدهای زیر رو بنویسین :
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
//The DLL statement
[StructLayout(LayoutKind.Sequential)]
public struct MARGINS
{
public int Left;
public int Right;
public int Top;
public int Bottom;
}
//The DLL statement
[DllImport("dwmapi.dll", PreserveSig = false)]
static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS
margins);
//The DLL statement
[DllImport("dwmapi.dll", PreserveSig = false)]
static extern bool DwmIsCompositionEnabled();
//Add the code directly
protected override void OnLoad(EventArgs e)
{
if (DwmIsCompositionEnabled())
{
MARGINS margins = new MARGINS();
margins.Right = margins.Left = margins.Top = margins.Bottom =
this.Width + this.Height;
DwmExtendFrameIntoClientArea(this.Handle, ref margins);
}
base.OnLoad(e);
}
//Add the code directly
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
if (DwmIsCompositionEnabled())
{
e.Graphics.Clear(Color.Black);
}
}
public Form1()
{
InitializeComponent();
}
}
}
فضای نام زیر رو هم اضافه کنید
using System.Runtime.InteropServices;
برنامه رو اجرا و حالشو ببرین:)))
توسط
یونس ابراهیمی
(6,480 امتیاز)
●6 ●17 ●129