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
<00089004B055 2 R WM_GETTEXTLENGT H cch:0
<00090004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479CC D0
<00091004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479CC D0 ("")
<00092004B055 2 R WM_ERASEBKGND fErased:True
<00093004B055 2 S WM_WINDOWPOSCHA NGED lpwp:0479DCDC
<00094004B055 2 S WM_MOVE xPos:31 yPos:50
<00095004B055 2 S WM_GETTEXTLENGT H
<00096004B055 2 R WM_GETTEXTLENGT H cch:0
<00097004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479C3 48
<00098004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479C3 48 ("")
<00099004B055 2 R WM_MOVE
<00100004B055 2 S WM_SIZE fwSizeType:SIZE _RESTORED nWidth:282 nHeight:263
<00101004B055 2 R WM_SIZE
<00102004B055 2 S WM_GETTEXTLENGT H
<00103004B055 2 R WM_GETTEXTLENGT H cch:0
<00104004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479CD 18
<00105004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479CD 18 ("")
<00106004B055 2 S WM_GETTEXTLENGT H
<00107004B055 2 R WM_GETTEXTLENGT H cch:0
<00108004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479CD 18
<00109004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479CD 18 ("")
<00110004B055 2 S WM_WINDOWPOSCHA NGING lpwp:0479D574
<00111004B055 2 S WM_GETMINMAXINF O lpmmi:0479CCD8
<00112004B055 2 R WM_GETMINMAXINF O lpmmi:0479CCD8
<00113004B055 2 R WM_WINDOWPOSCHA NGING
<00114004B055 2 S WM_NCCALCSIZE fCalcValidRects :True lpncsp:0479D548
<00115004B055 2 R WM_NCCALCSIZE fuValidRect:000 0 lpncsp:0479D548
<00116004B055 2 S WM_NCPAINT hrgn:00000001
<00117004B055 2 S WM_GETTEXT cchTextMax:510 lpszText:0479C4 D0
<00118004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479C4 D0 ("")
<00119004B055 2 R WM_NCPAINT
<00120004B055 2 S WM_ERASEBKGND hdc:B0011B76
<00121004B055 2 S WM_GETTEXTLENGT H
<00122004B055 2 R WM_GETTEXTLENGT H cch:0
<00123004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479C5 60
<00124004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479C5 60 ("")
<00125004B055 2 R WM_ERASEBKGND fErased:True
<00126004B055 2 S WM_WINDOWPOSCHA NGED lpwp:0479D574
<00127004B055 2 S WM_SIZE fwSizeType:SIZE _RESTORED nWidth:272 nHeight:253
<00128004B055 2 R WM_SIZE
<00129004B055 2 S WM_GETTEXTLENGT H
<00130004B055 2 R WM_GETTEXTLENGT H cch:0
<00131004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479C4 54
<00132004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479C4 54 ("")
<00133004B055 2 S WM_GETTEXTLENGT H
<00134004B055 2 R WM_GETTEXTLENGT H cch:0
<00135004B055 2 S WM_GETTEXT cchTextMax:2 lpszText:0479C5 B8
<00136004B055 2 R WM_GETTEXT cchCopied:0 lpszText:0479C5 B8 ("")
<00137004B055 2 S WM_GETTEXTLENGT H
<00138004B055 2 R WM_GETTEXTLENGT H cch:0
"slg" <sl*@abc.comwro te in message
news:e$******** *******@TK2MSFT NGP03.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.comwro te in message
news:AE******** *************** ***********@mic rosoft.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(re f m);
break;
case WM_NCPAINT:
WmNCPaint(ref m);
break;
default:
base.WndProc(re f 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]