G
Guest
Hi,
I have problem with creating own form. I need to make own header of form -
caption and buttons(minimize,restore,close). So I override WndProc and insert
in the switch own code for message WM_NCCALCSIZE.
Everything looks OK, but when I maximize and restore window, it shorts -
height is about 5px lower and width around 3px. So, when repeatly maximize
and restore window, its height is lower and lower.
When traced code, I noticed, that when I do not use own code for
wm_nccalcsize, I get 1times message WM_NCCALCSIZE, but when I use my code, I
get this message 3times during restoring the window
case (int)WinAPI_WM.WM_NCCALCSIZE:
WinAPI_NCCALCSIZE_PARAMS csp;
csp = (WinAPI_NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam,
typeof(WinAPI_NCCALCSIZE_PARAMS));
csp.rgrc0.Top += 20;
csp.rgrc0.Bottom -= 3;
csp.rgrc0.Left += 3;
csp.rgrc0.Right -= 3;
Marshal.StructureToPtr(csp, m.LParam, false);
m.Result = IntPtr.Zero;
break;
Where can be problem? Thanks for any answer.
I have problem with creating own form. I need to make own header of form -
caption and buttons(minimize,restore,close). So I override WndProc and insert
in the switch own code for message WM_NCCALCSIZE.
Everything looks OK, but when I maximize and restore window, it shorts -
height is about 5px lower and width around 3px. So, when repeatly maximize
and restore window, its height is lower and lower.
When traced code, I noticed, that when I do not use own code for
wm_nccalcsize, I get 1times message WM_NCCALCSIZE, but when I use my code, I
get this message 3times during restoring the window
case (int)WinAPI_WM.WM_NCCALCSIZE:
WinAPI_NCCALCSIZE_PARAMS csp;
csp = (WinAPI_NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam,
typeof(WinAPI_NCCALCSIZE_PARAMS));
csp.rgrc0.Top += 20;
csp.rgrc0.Bottom -= 3;
csp.rgrc0.Left += 3;
csp.rgrc0.Right -= 3;
Marshal.StructureToPtr(csp, m.LParam, false);
m.Result = IntPtr.Zero;
break;
Where can be problem? Thanks for any answer.