tags:

views:

622

answers:

2

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).

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.

Thanks for your help all.

** I am aware of John's recommendation, but still seeking clearer direction, anybody feel free to put forward your ideas **

A: 

What you are talking about would require subclassing to get into the guts of the application. Esentially you would be skinning your form by intercepting certain messages (like WM_PAINT etc.). It's not a simple thing to do if you've never worked at that level before.

John
Well I'm already knee deep in invoking unmanaged libraries with the DWM API. So I'm happy to hear all solutions.
GONeale
Here is an introduction in case you haven't touched Subclassing or development in the deep internals of Windows: http://support.microsoft.com/kb/815775
John
+5  A: 

This should do it:

[DllImport("uxtheme.dll")]
public static extern int SetWindowThemeAttribute(IntPtr hWnd, WindowThemeAttributeType wtype, ref WTA_OPTIONS attributes, uint size);

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, WTA_NONCLIENT, ref wta, (uint)Marshal.SizeOf(typeof(WTA_OPTIONS)));
Factor Mystic
Can't resolve 'WindowThemeAttributeType' or 'WTA_NONCLIENT'.
GONeale
Nm. With help from this article (http://www.codeproject.com/KB/vista/HideCaptionIcon.aspx) I setup the references I needed. Cheers! This has been a big help.
GONeale
Pinvoke.net is also a big help figuring out these interop structures and stuff.
Factor Mystic