WordPad and Explorer uses separate toolbar for displaying Close button.
Due to this fact that CF.NET (1.0) doesn't support more than one toolbar
it's not so easy implement.
Actually if you would like to repeat something similiar you have to
write native control wrappers at least for "ReBarWindow32" (container
for toolbars), "ToolbarWindow32".
Here is a simple example how to create "ReBarWindow32":
....
private IntPtr GetHandle(System.Windows.Forms.Control c)
{
c.Capture = true;
IntPtr hwnd = GetCapture();
c.Capture = false;
return hwnd;
}
public ReBar(System.Windows.Forms.Control parent)
{
INITCOMMONCONTROLSEX c = new INITCOMMONCONTROLSEX();
c.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
InitCommonControlsEx(c);
//get instance handle
IntPtr m_instance = Core.GetModuleHandle(null);
IntPtr parent_hwnd = GetHandle(parent);
IntPtr styles = (IntPtr)((int)(Win32Window.WindowStyle.WS_CHILD |
Win32Window.WindowStyle.WS_VISIBLE |
Win32Window.WindowStyle.WS_BORDER) |
RBS_VARHEIGHT | RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NOPARENTALIGN);
handle = OpenNETCF.Win32.Win32Window.CreateWindowEx(IntPtr.Zero,
"ReBarWindow32", "",
styles, 0, 0, parent.Width, parent.Height, parent_hwnd, IntPtr.Zero,
m_instance, IntPtr.Zero);
//create control
//_msgwnd = new ControlMessageWindow(this, handle);
}
....
[StructLayout(LayoutKind.Sequential)]
internal class INITCOMMONCONTROLSEX
{
public INITCOMMONCONTROLSEX()
{
dwSize = Marshal.SizeOf(this);
}
public int dwSize;
public int dwICC;
}
const int RBS_VARHEIGHT = 0x0200;
const int RBS_BANDBORDERS = 0x0400;
const int CCS_NODIVIDER = 0x00000040;
const int CCS_NOPARENTALIGN = 0x00000008;
const int ICC_COOL_CLASSES = 0x400;
const int ICC_BAR_CLASSES = 0x004;
[DllImport("coredll.dll")]
internal extern static IntPtr GetCapture();
[DllImport("Commctrl.dll")]
private static extern bool InitCommonControlsEx(INITCOMMONCONTROLSEX c);
HTH
Sergey