Palette set fixed size - disable resize possibility
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've managed to get the palette set window to be fixed using this somewhat crude and brute force method:
Timer tDelayedResize = new Timer(); tDelayedResize.Interval = 5; tDelayedResize.Tick += (s, e) => { tDelayedResize.Stop(); //Do your ResizeEnd logic here //... _ps1.Size = constSize; }; _ps1.SizeChanged += (s, e) => { tDelayedResize.Stop(); tDelayedResize.Start(); }; }
however, I'm keen on finding a more slick way of achieving fixed palette size
After some soul searching, I came to realize I can hook to windows messages (MINMAXinfo, and similar)
for test purposes, I tried doing it on a winform... but still dont have the hang of it.
my ultimate goal would be that "resize cursor" doesnt even appear when hovering over PS corner... but even a constant size would be a treat at this point (my OCD just wont give me rest on this 1 :D)
private void button1_Click(object sender, EventArgs e) { if (hHook == 0) { // Create an instance of HookProc. HookProcedure = new HookProc(Form1.WinHookProc); hHook = SetWindowsHookEx( //WH_CALLWNDPROCRET, WH_CALLWNDPROC, HookProcedure, (IntPtr)0, AppDomain.GetCurrentThreadId()); } } public static int WinHookProc(int nCode, IntPtr wParam, IntPtr lParam) { //Marshall the data from the callback. //CWPretStruct MyHookStruct = (CWPretStruct)Marshal.PtrToStructure(lParam, typeof(CWPretStruct)); CWPSTRUCT MyHookStruct = (CWPSTRUCT)Marshal.PtrToStructure(lParam, typeof(CWPSTRUCT)); if (nCode < 0) { return CallNextHookEx(hHook, nCode, wParam, lParam); } else { MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(MyHookStruct.lparam, typeof(MINMAXINFO)); mmi.ptMaxSize.x = 300; mmi.ptMaxSize.y = 300; System.Runtime.InteropServices.Marshal.StructureToPtr(mmi, MyHookStruct.lparam, true); return CallNextHookEx(hHook, nCode, wParam, lParam); } }
any tips on how to override such features would be graetly appreciated;
If any1 can offer a better solution than my PS code, or a tip when it comes to Hooks, I'd be more than grateful!