:
Copy codeThe Code is as follows: using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Text;
Using System. Windows. Forms;
Using System. ServiceModel;
Using System. Runtime. InteropServices;
Namespace MyWeather
{
Public partial class Form1: Form
{
[StructLayout (LayoutKind. Sequential)]
Public struct MARGINS
{
Public int Left;
Public int Right;
Public int Top;
Public int Bottom;
}
[DllImport ("dwmapi. dll", PreserveSig = false)]
Static extern void dwmextendframeworkclientarea (IntPtr hwnd, ref MARGINS margins );
[DllImport ("dwmapi. dll", PreserveSig = false)]
Static extern bool DwmIsCompositionEnabled ();
Public Form1 ()
{
InitializeComponent ();
}
Protected override void OnLoad (EventArgs e)
{
If (DwmIsCompositionEnabled ())
{
MARGINS margins = new MARGINS ();
Margins. Right = margins. Left = margins. Top = margins. Bottom = this. Width + this. Height;
Dwmextendframeworkclientarea (this. Handle, ref margins );
}
Base. OnLoad (e );
}
Protected override void OnPaintBackground (PaintEventArgs e)
{
Base. OnPaintBackground (e );
If (DwmIsCompositionEnabled ())
{
E. Graphics. Clear (Color. Black );
}
}
}
}