<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ausrichtung in einem CFormView mittels OnSize]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe da ein Problem und bekomme es einfach nicht hin.<br />
In meinem Projekt habe ich von der Seite</p>
<p><a href="http://www.codeproject.com/treectrl/newtreelistcode.asp" rel="nofollow">http://www.codeproject.com/treectrl/newtreelistcode.asp</a></p>
<p>Das Beispiel herunter geladen und in mein Projekt eingebunden.<br />
Soweit funktioniert es auch.</p>
<p>Doch jetzt wollte ich, da ich es ja auf einem CFormView eingebastelt habe, das neue Projekt etwas nach Unten Verschieben.<br />
Es tut zwar, das richtige ergebnis bleibt aber aus.<br />
Das Projekt sollte 100 Punkte von der Oberen Kante entfernt sein...</p>
<pre><code class="language-cpp">void CProjekt::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	SetScrollRange(SB_HORZ, 0, 0);
	SetScrollRange(SB_VERT, 0, 0);

	if(m_TLInitialized)
	{	
		// resize all the controls	
		CRect m_wndRect;
		GetClientRect(&amp;m_wndRect);

		CRect m_headerRect;
		m_tree.m_wndHeader.GetClientRect(&amp;m_headerRect);
		m_tree.m_wndHeader.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_headerRect.Height(), SWP_NOMOVE);

		CRect m_scrollRect;
		m_horScrollBar.GetClientRect(&amp;m_scrollRect);

		m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height() - m_scrollRect.Height(), SWP_NOMOVE);

		CRect m_treeRect(0,120,cx,cy);
		m_tree.GetClientRect(&amp;m_treeRect);
		m_horScrollBar.MoveWindow(0, m_treeRect.bottom, m_wndRect.Width(), m_scrollRect.Height());

		if(m_tree.GetColumnsWidth() &gt; m_treeRect.Width())
		{
			// show the horz scroll bar
			{
				CRect m_barRect;
				m_horScrollBar.GetClientRect(&amp;m_barRect);			

				m_horScrollBar.EnableWindow(TRUE);

				m_horScrollBar.ShowWindow(SW_SHOW);

				// the tree becomes smaller
				m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height()-m_barRect.Height()-m_headerRect.Height(), SWP_NOMOVE);

				int tfdsfsd=m_wndRect.Width() - GetSystemMetrics(SM_CXVSCROLL);
				m_horScrollBar.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width() - GetSystemMetrics(SM_CXVSCROLL), m_barRect.Height(), SWP_NOMOVE);

			}

			m_horScrollBar.SetScrollRange(0, m_tree.GetColumnsWidth()-m_treeRect.Width());

		}
		else
		{
			// hide the scroll bar
			{
				m_horScrollBar.EnableWindow(FALSE);

				m_horScrollBar.ShowWindow(SW_HIDE);

				// the tree becomes larger
				m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height()-m_headerRect.Height(), SWP_NOMOVE);				
			}

			m_horScrollBar.SetScrollRange(0, 0);
		}

		m_tree.ResetVertScrollBar();

		// Reset the header control position and scroll
		// the tree control as required.
		int m_nCurPos = m_horScrollBar.GetScrollPos();
		m_tree.m_nOffset = -m_nCurPos;

		// smoothly scroll the tree control
	    {
		CRect m_scrollRect;
		m_tree.GetClientRect(&amp;m_scrollRect);
		m_tree.ScrollWindow(m_nCurPos, 0, &amp;m_scrollRect, &amp;m_scrollRect);
		}
		m_tree.m_wndHeader.GetWindowRect(&amp;m_headerRect);	
		GetClientRect(&amp;m_wndRect);

		m_tree.m_wndHeader.SetWindowPos(&amp;wndTop, m_tree.m_nOffset, 100,max(StretchWidth(m_tree.GetColumnsWidth(),m_treeRect.Width()),m_wndRect.Width()), m_headerRect.Height(),SWP_SHOWWINDOW);			
	}	
}
</code></pre>
<p>Kann mir jeman dazu Helfen ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/74764/ausrichtung-in-einem-cformview-mittels-onsize</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 07:03:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/74764.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 May 2004 15:04:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ausrichtung in einem CFormView mittels OnSize on Mon, 24 May 2004 15:04:26 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe da ein Problem und bekomme es einfach nicht hin.<br />
In meinem Projekt habe ich von der Seite</p>
<p><a href="http://www.codeproject.com/treectrl/newtreelistcode.asp" rel="nofollow">http://www.codeproject.com/treectrl/newtreelistcode.asp</a></p>
<p>Das Beispiel herunter geladen und in mein Projekt eingebunden.<br />
Soweit funktioniert es auch.</p>
<p>Doch jetzt wollte ich, da ich es ja auf einem CFormView eingebastelt habe, das neue Projekt etwas nach Unten Verschieben.<br />
Es tut zwar, das richtige ergebnis bleibt aber aus.<br />
Das Projekt sollte 100 Punkte von der Oberen Kante entfernt sein...</p>
<pre><code class="language-cpp">void CProjekt::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);

	SetScrollRange(SB_HORZ, 0, 0);
	SetScrollRange(SB_VERT, 0, 0);

	if(m_TLInitialized)
	{	
		// resize all the controls	
		CRect m_wndRect;
		GetClientRect(&amp;m_wndRect);

		CRect m_headerRect;
		m_tree.m_wndHeader.GetClientRect(&amp;m_headerRect);
		m_tree.m_wndHeader.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_headerRect.Height(), SWP_NOMOVE);

		CRect m_scrollRect;
		m_horScrollBar.GetClientRect(&amp;m_scrollRect);

		m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height() - m_scrollRect.Height(), SWP_NOMOVE);

		CRect m_treeRect(0,120,cx,cy);
		m_tree.GetClientRect(&amp;m_treeRect);
		m_horScrollBar.MoveWindow(0, m_treeRect.bottom, m_wndRect.Width(), m_scrollRect.Height());

		if(m_tree.GetColumnsWidth() &gt; m_treeRect.Width())
		{
			// show the horz scroll bar
			{
				CRect m_barRect;
				m_horScrollBar.GetClientRect(&amp;m_barRect);			

				m_horScrollBar.EnableWindow(TRUE);

				m_horScrollBar.ShowWindow(SW_SHOW);

				// the tree becomes smaller
				m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height()-m_barRect.Height()-m_headerRect.Height(), SWP_NOMOVE);

				int tfdsfsd=m_wndRect.Width() - GetSystemMetrics(SM_CXVSCROLL);
				m_horScrollBar.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width() - GetSystemMetrics(SM_CXVSCROLL), m_barRect.Height(), SWP_NOMOVE);

			}

			m_horScrollBar.SetScrollRange(0, m_tree.GetColumnsWidth()-m_treeRect.Width());

		}
		else
		{
			// hide the scroll bar
			{
				m_horScrollBar.EnableWindow(FALSE);

				m_horScrollBar.ShowWindow(SW_HIDE);

				// the tree becomes larger
				m_tree.SetWindowPos(&amp;wndTop, 0, 0, m_wndRect.Width(), m_wndRect.Height()-m_headerRect.Height(), SWP_NOMOVE);				
			}

			m_horScrollBar.SetScrollRange(0, 0);
		}

		m_tree.ResetVertScrollBar();

		// Reset the header control position and scroll
		// the tree control as required.
		int m_nCurPos = m_horScrollBar.GetScrollPos();
		m_tree.m_nOffset = -m_nCurPos;

		// smoothly scroll the tree control
	    {
		CRect m_scrollRect;
		m_tree.GetClientRect(&amp;m_scrollRect);
		m_tree.ScrollWindow(m_nCurPos, 0, &amp;m_scrollRect, &amp;m_scrollRect);
		}
		m_tree.m_wndHeader.GetWindowRect(&amp;m_headerRect);	
		GetClientRect(&amp;m_wndRect);

		m_tree.m_wndHeader.SetWindowPos(&amp;wndTop, m_tree.m_nOffset, 100,max(StretchWidth(m_tree.GetColumnsWidth(),m_treeRect.Width()),m_wndRect.Width()), m_headerRect.Height(),SWP_SHOWWINDOW);			
	}	
}
</code></pre>
<p>Kann mir jeman dazu Helfen ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/526373</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/526373</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Mon, 24 May 2004 15:04:26 GMT</pubDate></item></channel></rss>