日期:2014-05-17 浏览次数:21184 次
[DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
private const int WM_NCPAINT = 0x0085;
private const int WM_NCACTIVATE = 0x0086;
private const int WM_NCLBUTTONDOWN = 0x00A1;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
Rectangle vRectangle = new Rectangle((Width + 105) / 2, 6, 23, 20);
switch (m.Msg)
{
case WM_NCPAINT:
case WM_NCACTIVATE:
IntPtr vHandle = GetWindowDC(m.HWnd);
Graphics vGraphics = Graphics.FromHdc(vHandle);
vGraphics.FillRectangle(new LinearGradientBrush(vRectangle,
Color.Pink, Color.Purple, LinearGradientMode.BackwardDiagonal),
vRectangle);
StringFormat vStringFormat = new StringFormat();
vStringFormat.Alignment = StringAlignment.Center;
vStringFormat.LineAlignment = StringAlignment.Center;
vGraphics.DrawString("…", Font, Brushes.BlanchedAlmond,
vRectangle, vStringFormat);
vGraphics.Dispose();
&nbs