I did a spy trace and clearly the height is reduced from 263 to 253 and so
is width.
I belive its do with WM_SIZE
<00089004B0552 R WM_GETTEXTLENGTH cch:0
<00090004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479CCD0
<00091004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479CCD0 ("")
<00092004B0552 R WM_ERASEBKGND fErased:True
<00093004B0552 S WM_WINDOWPOSCHANGED lpwp:0479DCDC
<00094004B0552 S WM_MOVE xPos:31 yPos:50
<00095004B0552 S WM_GETTEXTLENGTH
<00096004B0552 R WM_GETTEXTLENGTH cch:0
<00097004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479C348
<00098004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479C348 ("")
<00099004B0552 R WM_MOVE
<00100004B0552 S WM_SIZE fwSizeType:SIZE_RESTORED nWidth:282 nHeight:263
<00101004B0552 R WM_SIZE
<00102004B0552 S WM_GETTEXTLENGTH
<00103004B0552 R WM_GETTEXTLENGTH cch:0
<00104004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479CD18
<00105004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479CD18 ("")
<00106004B0552 S WM_GETTEXTLENGTH
<00107004B0552 R WM_GETTEXTLENGTH cch:0
<00108004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479CD18
<00109004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479CD18 ("")
<00110004B0552 S WM_WINDOWPOSCHANGING lpwp:0479D574
<00111004B0552 S WM_GETMINMAXINFO lpmmi:0479CCD8
<00112004B0552 R WM_GETMINMAXINFO lpmmi:0479CCD8
<00113004B0552 R WM_WINDOWPOSCHANGING
<00114004B0552 S WM_NCCALCSIZE fCalcValidRects:True lpncsp:0479D548
<00115004B0552 R WM_NCCALCSIZE fuValidRect:0000 lpncsp:0479D548
<00116004B0552 S WM_NCPAINT hrgn:00000001
<00117004B0552 S WM_GETTEXT cchTextMax:510 lpszText:0479C4D0
<00118004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479C4D0 ("")
<00119004B0552 R WM_NCPAINT
<00120004B0552 S WM_ERASEBKGND hdc:B0011B76
<00121004B0552 S WM_GETTEXTLENGTH
<00122004B0552 R WM_GETTEXTLENGTH cch:0
<00123004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479C560
<00124004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479C560 ("")
<00125004B0552 R WM_ERASEBKGND fErased:True
<00126004B0552 S WM_WINDOWPOSCHANGED lpwp:0479D574
<00127004B0552 S WM_SIZE fwSizeType:SIZE_RESTORED nWidth:272 nHeight:253
<00128004B0552 R WM_SIZE
<00129004B0552 S WM_GETTEXTLENGTH
<00130004B0552 R WM_GETTEXTLENGTH cch:0
<00131004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479C454
<00132004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479C454 ("")
<00133004B0552 S WM_GETTEXTLENGTH
<00134004B0552 R WM_GETTEXTLENGTH cch:0
<00135004B0552 S WM_GETTEXT cchTextMax:2 lpszText:0479C5B8
<00136004B0552 R WM_GETTEXT cchCopied:0 lpszText:0479C5B8 ("")
<00137004B0552 S WM_GETTEXTLENGTH
<00138004B0552 R WM_GETTEXTLENGTH cch:0
"slg" <sl*@abc.comwrote in message
news:e$***************@TK2MSFTNGP03.phx.gbl...
Morten , I tried it and it works great except one bug.
when the form looses focus and i activate it by clicking on the taskbar
the size decreases by the amount of pixels
i added to the caption.
any thoughts.
"Morten Wennevik [C# MVP]" <Mo************@hotmail.comwrote in message
news:AE**********************************@microsof t.com...
>>
"slg" wrote:
>>Is there a simpler way to increase the mdi form caption height?
I'm afraid not
>>I am following this article but not sure where should i change?
I belive its most probably in the WmNCCalcSize
TIA
http://geekswithblogs.net/kobush/art...rderForms.aspx
There is an updated article on CodePlex
http://www.codeplex.com/Wiki/View.as...omerBorderForm
What you basically need to do is override the default handling of the Non
Client messages (NC_xxx) by overriding WndProc in your child form and
route
some messages to your own code.
const int WM_SETTEXT = 0x000c;
const int WM_NCCALCSIZE = 0x0083;
const int WM_NCPAINT = 0x0085;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_SETTEXT:
WmSetText(ref m);
break;
case WM_NCCALCSIZE:
WmNCCalcSize(ref m);
break;
case WM_NCPAINT:
WmNCPaint(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
You change the size in WmNCCalcSize, draw the border and caption in
WmNCPaint and the caption text in WmSetText. If you just want to change
the
size, you still need to do the drawing since the border is a set of
images
that may not fit the new size. The rest of the messages can probably
safely
be ignored and left to Windows to handle.
If you haven't already I suggest you download or view the source code
(Source Code tab above the article).
--
Happy Coding!
Morten Wennevik [C# MVP]