Splitter resizen >First Blood Part 2 < "...noch ein kleines Problem"
-
Hi ;),
ich habe einen Splitter in einer SDI und möchte diesen resizen Maximize/ Restore.
Prinzipiell klappt das auch, das heißt wenn ich die SDI maximiere klappt das, die erste Row wird vergrößert, wenn ich dann aber resoren will hat das keinen Effekt, die Row bleibt wie sie ist und wird nicht proportional verkleinert
!Hier ist mein Code:
/************************************************************************/ /* Resizen des Splitters */ /************************************************************************/ void CMainFrame::OnSize(UINT nType, int cx, int cy) { int iCurRow_cy = 0, iMin_cy = 0; static int iOldWnd_cy = 0, iOldWnd_cx = 0; int iNewCurRow_cy = 0; static int iZaehler = 0; static CString a, b, c, d; iZaehler++; if (iZaehler == 1) { iOldWnd_cy = cy; a.Format("%02d",iOldWnd_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow_cy); d.Format("%02d",iNewCurRow_cy); MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: iZaehler == 1 " ,MB_OK); } if ((nType == SIZE_MAXIMIZED)) { m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy); iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, 1); a.Format("%02d",iOldWnd_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow_cy); d.Format("%02d",iNewCurRow_cy); MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_MAXIMIZED " ,MB_OK); m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0); // m_Splitter_Main.SetRowInfo(1, spRect.Height()/4, 0); // m_Splitter_Main.SetRowInfo(2, spRect.Height()/4, 0); // m_Splitter_Main.SetRowInfo(3, spRect.Height()/4, 0); m_Splitter_Main.RecalcLayout(); } else if((!m_Splitter_Main.m_hWnd && nType == SIZE_RESTORED)) { m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy); iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, (1)); a.Format("%02d",iOldWnd_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow_cy); d.Format("%02d",iNewCurRow_cy); MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_RESTORED " ,MB_OK); m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0); m_Splitter_Main.RecalcLayout(); } CFrameWnd::OnSize(nType, cx, cy); }double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int iZahl) { double iNewCurRow_cy; double iDiff; double iFaktor; CString ccc; CString ddd; CString aaa; CString bbb; iDiff = cy - iOldWnd_cy; iFaktor = iDiff / cy; iNewCurRow_cy = (iCurRow_cy * ((iFaktor)+(iZahl))); return iNewCurRow_cy; }Was läuft da schief, könnt Ihr mir helfen ?
Vielen Dank für eure Hilfe und Mühe vorab

ShadowEater
-
Ich verstehe Deinen Code incht.
Was soll der tun?Warum hast Du für SIZE_RESTORED und SIZE_MAXIMIZED unterschiedlichen Blöcke?
Das habe ich Dich schon mal gefragt.
Das sieht doch alles gleich aus?
-
Hi Martin,
mein Code soll einfach die Panes eines Splitters vergrößern oder verkleinern (SIZE_MAXIMIZED / SIZE_RESTORED) je nachdem ob das Fenster maximiert wird oder restored (nochmaliges klicken auf den maximize Button) wird. Das ganze proportional zur größe des Fensters eben, d.h. wenn ich ein kleines Fenster maximiere dann "wächst" der (die) Pane(s) des Splitters mit und wenn restored (die ursprüngliche Größe wieder hergestellt wird,) wird, dann "schrumpfen die Panes mit dem Fenster mit.
Hier die exe :http://www.filehosting.org/file/details/285/n6s28J1URUVZzP85/Test_01.exe
Du kannst sehen was ich meine wenn Du vergrößerst, dann klappt das mit der 1. Zeile aber eben nur das vergrößern nicht das restoren !!!
Hier der geänderte Code :
void CMainFrame::OnSize(UINT nType, int cx, int cy) { int iCurRow_cy = 0, iMin_cy = 0; static int iOldWnd_cy = 0, iOldWnd_cx = 0; int iNewCurRow_cy = 0; static int iZaehler = 0; static CString a, b, c, d; iZaehler++; if (iZaehler == 1) { iOldWnd_cy = cy; a.Format("%02d",iOldWnd_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow_cy); d.Format("%02d",iNewCurRow_cy); MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: iZaehler == 1 " ,MB_OK); } if ((nType == SIZE_MAXIMIZED)||(!m_Splitter_Main.m_hWnd && nType == SIZE_RESTORED)) { m_Splitter_Main.GetRowInfo(0 ,iCurRow_cy, iMin_cy); iNewCurRow_cy = (int)ResizeSplitter(cx, cy, iOldWnd_cx, iOldWnd_cy, iCurRow_cy, 1); a.Format("%02d",iOldWnd_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow_cy); d.Format("%02d",iNewCurRow_cy); MessageBox("iOldWnd_cy: "+ a + "\ncy: " + b + "\niCurRow_cy: " + c + "\niNewCurRow_cy: " + d,"in: SIZE_MAXIMIZED " ,MB_OK); m_Splitter_Main.SetRowInfo(0, iNewCurRow_cy , 0); // m_Splitter_Main.SetRowInfo(1, spRect.Height()/4, 0); // m_Splitter_Main.SetRowInfo(2, spRect.Height()/4, 0); // m_Splitter_Main.SetRowInfo(3, spRect.Height()/4, 0); m_Splitter_Main.RecalcLayout(); } CFrameWnd::OnSize(nType, cx, cy);ResizeSplitter() ist unverändert s.o. !
Gruß
ShadowEater