[英]C# Hide title in title bar
Is it possible to hide the title of my application in the title bar, but in a way that it still appears on the taskbar? 是否可以在标题栏中隐藏我的应用程序的标题,但仍以某种方式显示在任务栏上? Just like "ShowIcon" just for the title of application?
就像“ ShowIcon”一样,只是标题?
I'm currently doing it that way with the DWM: but this only works with Vista or higher. 我目前正在DWM中使用这种方式:但这仅适用于Vista或更高版本。 Is there a cleaner solution?
有没有更清洁的解决方案?
protected override void OnLoad(EventArgs e)
{
if (Environment.OSVersion.Version.Build >= 6000)
{
if (DWM.DwmIsCompositionEnabled())
{
M = new DWM.MARGINS();
DWM.DwmExtendFrameIntoClientArea(Handle, ref M);
DWM.WTA_OPTIONS o = new DWM.WTA_OPTIONS();
o.F = DWM.WTNCA_NODRAWCAPTION | DWM.WTNCA_NODRAWICON;
o.M = DWM.WTNCA_NODRAWCAPTION | DWM.WTNCA_NODRAWICON;
DWM.SetWindowThemeAttribute(Handle,
DWM.WindowThemeAttributeType.WTA_NONCLIENT,
ref o,
(uint)Marshal.SizeOf(typeof(DWM.WTA_OPTIONS))
);
}
}
base.OnLoad(e);
}
This answer is a simple and crazy one.. You 'll laugh at this ;) BUt you can set your Text as empty string ("") in your Form title. 这个答案是一个简单而疯狂的答案。.您会对此大笑;)但是,您可以在Form标题中将Text设置为空字符串(“”)。 It won't show your title either form or task-bar.
它既不会显示标题,也不会显示表格或任务栏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.