问题描述
我与Windows窗体的工作,是有可能创造具有在状态栏文本的窗口,但在应用程序顶部的标题栏中没有文字? (很大程度上是因为它打印在我的Aero玻璃我已经实现了标准的标题文字看起来很可怕,因为它是太高了,我画我自己的文字标题,显然不希望翻倍)。
I am working with Windows Forms, is it possible to create a window which has text in the status bar, but has no text in the title bar at the top of the application? (Largely because the standard title text which prints on my Aero glass I have implemented looks terrible as it's too high and I am drawing my own text title and obviously don't want the double up).
这溶液(的)不令人满意,因为我还是想保留一个 FixedDialog
窗框。
This solution (http://stackoverflow.com/questions/198233/how-to-make-a-window-have-taskbar-text-but-no-title-bar) is not satisfactory as I still wish to keep a FixedDialog
window frame.
感谢您的帮助所有。
** 我知道约翰的建议,但仍然在寻求更清晰的方向,任何人随时提出你的想法 **
推荐答案
这应该这样做:
[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)));
这篇关于删除窗口的标题栏文字,但保持状态栏文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!