<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : A better CXTResize&#070;ormView (code inside)</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : A better CXTResize&#070;ormView (code inside)]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 16 Apr 2026 03:02:24 +0000</pubDate>
  <lastBuildDate>Tue, 09 Dec 2003 08:35:24 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=282</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[A better CXTResize&#070;ormView (code inside) : Im the last person to write better...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=282&amp;PID=648&amp;title=a-better-cxtresizeformview-code-inside#648</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=245">ddyer</a><br /><strong>Subject:</strong> 282<br /><strong>Posted:</strong> 09 December 2003 at 8:35am<br /><br /><P><FONT face="Arial, Helvetica, sans-serif" size=2>Im the last person to write better MFC code than these gurus, but I think this is probably an underutilized class so it fell through the cracks.</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>The problem:</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2><BR>Create a CXTResizeFormView from a dialog&nbsp;and&nbsp;start your application.&nbsp; Grab the right edge of the window and shrink it to the left until you get the horizontal scroll bar (but not a vertical one).&nbsp; Thats correct behavior so far.&nbsp; Now, enlarge the window in the vertical direction (drag the resize handle downward).&nbsp; You see that the form did not resize in&nbsp;the vertical direction, even though there was plenty of room to do so.&nbsp; All resizing stops as soon as either the vertical or horizontal scrollbar makes an appearance.&nbsp; That is correct behavior for when both scrollbars are needed (H &amp; V), but when you have just one, the other direction should freely expand.</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>Now, slowly enlarge the window to the right until the horizontal scroll bar is no longer needed.&nbsp; VOOM! The form suddenly enlarged to fill the window.<BR><BR>A cheap solution:</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>1) Add two protected fields to your formview class: int lastCx, lastCy.&nbsp; Initialize them to 0 in your creation method.</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>2) Create an OnSize message handler that has two lines of code:</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>CFormView::OnSize(nType, cx, cy);<BR>FormSize(cx, cy);</FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2>3) Go to the CXTResize source code and add the following static method into your cpp file:&nbsp; <FONT color=#0000ff>static</FONT> <FONT color=#0000ff>bool</FONT></FONT></FONT><FONT face="Arial, Helvetica, sans-serif" size=2> _IsGroupBox(HWND hWnd)<BR><BR>4) now we create the FormSize() method.&nbsp; Base it on the Size() method from the&nbsp;CXTResize source (cut and paste it).</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>5) The following changes need to be made to the FormSize method:</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2></FONT>&nbsp;</P><P><FONT face="Arial, Helvetica, sans-serif" size=2>Just AFTER the line "<FONT color=#0000ff>int</FONT> dx = rcWindow.Width() - m_rcWindow.Width();" add</FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#0000ff>if</FONT> (cx &lt; m_totalLog.cx) dx = 0;</FONT></FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2></FONT>&nbsp;</P><P><FONT face="Arial, Helvetica, sans-serif" size=2>Just AFTER the line "<FONT color=#0000ff>int</FONT> dy = rcWindow.Height() - m_rcWindow.Height();" add</FONT></P><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#0000ff>if</FONT> (cy &lt; m_totalLog.cy) dy = 0;</FONT></FONT></P><P><FONT size=2><FONT face="Arial, Helvetica, sans-serif">&nbsp;</P></FONT></FONT><P><FONT face="Arial, Helvetica, sans-serif"><FONT size=2>Just PRIOR to the line "m_rcWindow = rcWindow;" add the following:</FONT></P></FONT><P><FONT face="Arial, Helvetica, sans-serif" color=#0000ff size=2>if</FONT><FONT face="Arial, Helvetica, sans-serif"><FONT size=2> (cx &gt;= m_totalLog.cx &amp;&amp; cy &gt;= m_totalLog.cy) {<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; if</FONT></FONT></FONT><FONT face="Arial, Helvetica, sans-serif" size=2> (lastCx &lt; m_totalLog.cx || lastCy &lt; m_totalLog.cy) {<BR>&nbsp;&nbsp;&nbsp; CXTResize::Reset();<BR>&nbsp; }<BR>}</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2>lastCx = cx;<BR>lastCy = cy;</FONT></P><P><FONT face="Arial, Helvetica, sans-serif" size=2></FONT>&nbsp;</P><P><FONT face="Arial, Helvetica, sans-serif" size=2>Now resize the window as mentioned earlier.&nbsp; There are still problems if the formview is a tabbed view and it is not the active window, the window gets resized, then the view is made active.&nbsp; But its much better than before.</FONT></P>]]>
   </description>
   <pubDate>Tue, 09 Dec 2003 08:35:24 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=282&amp;PID=648&amp;title=a-better-cxtresizeformview-code-inside#648</guid>
  </item> 
 </channel>
</rss>