How do I split a window up (without using MFC) like HTML's frames option?
How do I split a window up (without using MFC) like HTML's frames option?
nevermind, I figured it out. Thanks anyways though.
OK, I figured out how to do it, but now I have another problem... I'm trying to figure out what to make of this code:
It's really only the height that I'm having trouble with (the 5th parameter)... it seems that no matter how I mess with it, something messes up. All I want is to have the top window taller than the bottom window... Anyone?Code:int nSplitterPos = 100; int nSplitterBorder = 2; void SizeWindowContents(int nWidth, int nHeight) { MoveWindow(hEdit1, 0, 0, nWidth, nSplitterPos, TRUE); MoveWindow(hEdit2, 0, nSplitterPos + nSplitterBorder, nWidth, nHeight - nSplitterPos - nSplitterBorder, TRUE); }
Many thanks
Chris
It will take a little more math then whats in the SizeWindowContents() function you posted above... you could use something like this:
Might be a simpler way of doing the code except I don't care to think about it right now lol. I used some of the variables from your example just because I figure you already have them setup as globally (assuming of course).Code:void SizeWindowContents(HWND hParent, int tRatio) { RECT wRect; int tHeight, bHeight; GetWindowRect(hParent, &wRect); tHeight = (wRect.bottom - wRect.top) * (tPerc - 100); bHeight = (wRect.bottom - wRect.top) - tHeight; MoveWindow(hEdit1, 0, 0, wRect.right - wRect.left, tHeight, TRUE); MoveWindow(hEdit2, 0, tHeight + nSplitterBorder, wRect.right - wRect.left, bHeight - nSplitterBorder, TRUE); }
Hope this helps,
cyreon
Thanks cryeon - but I think I figured out an easier way. It was actually simpler without rect. Although that would be for dynamic sizing, no? Right now I have it static - i.e. they're the same size no matter if the window is maximized or minimized. But thanks for the other example.