我正在使用Windows窗体,是否可以创建一个窗口,其状态栏中包含文本,但在应用程序顶部的标题栏中没有文本?(很大程度上是因为在我的Aero玻璃上打印的标准标题文本看起来很糟糕,因为它太高而且我正在绘制自己的文本标题,显然不希望双倍增加).
这个解决方案(如何使窗口具有任务栏文本但没有标题栏)并不令人满意,因为我仍然希望保留一个FixedDialog窗口框架.
谢谢你的帮助.
**我知道约翰的建议,但仍在寻求更明确的方向,任何人都可以随意提出你的想法**
这应该这样做:
[DllImport("uxtheme.dll")]
public static extern int SetWindowThemeAttribute(IntPtr hWnd, WindowThemeAttributeType wtype, ref WTA_OPTIONS attributes, uint size);
public enum WindowThemeAttributeType : uint
{
/// <summary>Non-client area window attributes will be set.</summary>
WTA_NONCLIENT = 1,
}
public struct WTA_OPTIONS
{
public uint Flags;
public uint Mask;
}
public static uint WTNCA_NODRAWCAPTION = 0x00000001;
public static uint WTNCA_NODRAWICON = 0x00000002;
WTA_OPTIONS wta = new WTA_OPTIONS() { Flags = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON, Mask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON };
SetWindowThemeAttribute(this.Handle, WindowThemeAttributeType.WTA_NONCLIENT, ref wta, (uint)Marshal.SizeOf(typeof(WTA_OPTIONS)));
Run Code Online (Sandbox Code Playgroud)