How do I get more of win7 aero-glass area by decreasing main control container? (C#)

StackOverflow https://stackoverflow.com/questions/10472995

  •  06-06-2021
  •  | 
  •  

سؤال

By default, the form has a limited size title area to which the aero-glass effect is applied. I'd like to increase that area, not only at the title, but at the bottom and the sides of my form. scheme

هل كانت مفيدة؟

المحلول

Use DwmExtendFrameIntoClientArea:

[StructLayout(LayoutKind.Sequential)]
struct MARGINS {
    int Left;
    int Right;
    int Top;
    int Bottom;
}

[DllImport("user32.dll")]
public static extern IntPtr DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);

Call DwmExtendFrameIntoClientArea with your form's Handle and a MARGINS structure. Just set Left, Right, Top and Bottom to the amount you want the respective borders extended by.

Oh, and set the BackColor of your form to Black. (Thanks, @HansPassant!)

Sorry if I got the extern syntax wrong. I haven't ever done this in C#...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top