Hello there,
I am struggling to make some of our Ribbon applications work accordingly.
A sample application can be downloaded from (WeTransfer):
https://we.tl/t-HPR9RJeA7a
(sorry but I couldn't attach the file - "Inappropriate file format" displayed).
This application uses a Ribbon form that overrides the default Windows frame and title bar.
The two trouble scenarios I'm facing are:
- When "Avoid Double Frames" option is off, the application will behave in more stable manner.
But the Winflector's client title bar will truncate (and so the window's bottom edge), which turns somehow difficult to the user to resize/maximize/minimize/close the form.
Avoiding the "double" title bar is desirable, but not a "must have".
- When "Avoid Double Frames" option is on, is solves the two title bars issue, and the user is able to resize the form and click its title's buttons,
but the application will ocasionally get an "OverflowException" error. This is intermitent (you may need to resize the window some times to the error occur)
In the second case, the error is thrown inside this code (C#/.NET):
public static IntPtr GetDC(IntPtr handle, Message msg) {
IntPtr res = IntPtr.Zero;
if(msg.Msg == MSG.WM_NCPAINT) {
int flags = NativeMethods.DC.DCX_CACHE | NativeMethods.DC.DCX_CLIPSIBLINGS | NativeMethods.DC.DCX_WINDOW | NativeMethods.DC.DCX_VALIDATE;
IntPtr hrgnCopy = IntPtr.Zero;
if(msg.WParam.ToInt32() != 1) {
flags |= NativeMethods.DC.DCX_INTERSECTRGN;
// [GDI32.dll] IntPtr CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
hrgnCopy = NativeMethods.CreateRectRgn(0, 0, 1, 1);
// [GDI32.dll] int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, int fnCombineMode);
NativeMethods.CombineRgn(hrgnCopy, msg.WParam, IntPtr.Zero, NativeMethods.RGN_COPY);
}
// [USER32.dll] IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
res = NativeMethods.GetDCEx(handle, hrgnCopy, flags);
return res;
}
// [USER32.dll] IntPtr GetWindowDC(IntPtr hwnd);
return NativeMethods.GetWindowDC(handle);
}
Please advise.
- Jônatas