overview.htm

来自「创建可改变大小的对话框或框架的程序」· HTM 代码 · 共 176 行

HTM
176
字号
<html>

<head>
<title>Overview</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">

<meta name="Microsoft Border" content="tb, default"></head>

<body><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>

<p align="center"><MAP NAME="FrontPageMap"><AREA SHAPE="RECT" COORDS="6, 5, 179, 53" HREF="http://www.stonehorse.com"></MAP><a href="_vti_bin/shtml.exe/overview.htm/map"><img align="left" ismap usemap="#FrontPageMap" border="0" alt="www.stonehorse.com" src="images/Small_logo.gif"></a><strong><font size="6">GeometryManager</font><br>
<font size="3">Version 1.01</font></strong></p>
</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top">

<p><!--webbot bot="Navigation" S-Type="siblings" S-Orientation="horizontal" S-Rendering="graphics" B-Include-Home="TRUE" B-Include-Up="FALSE" startspan --><nobr>[&nbsp;<a href="index.htm">Home</a>&nbsp;]</nobr> <nobr>[&nbsp;<a href="introduction.htm">Introduction</a>&nbsp;]</nobr> <nobr>[&nbsp;Overview&nbsp;]</nobr> <nobr>[&nbsp;<a href="platform.htm">Platform&nbsp;Notes</a>&nbsp;]</nobr> <nobr>[&nbsp;<a href="Reference.htm">Reference</a>&nbsp;]</nobr> <nobr>[&nbsp;<a href="history.htm">History</a>&nbsp;]</nobr><!--webbot bot="Navigation" endspan i-checksum="15213" --></p>
<b><font FACE="Arial" SIZE="4">

<h1></font><font face="Arial">Overview</font></b></h1>

<p><font size="3">GeometryManager uses a simple parent-child method of specifying the
layout of the controls in the resizable window. There are three ways to control how a
group and its children are sized and positioned. 

<ul>
  <i>
  <li>Arrangement of children</i>. Child groups can be arranged in one of three ways:
    horizontally or vertically in the order that they are added to the manager, or overlapped.
    The overlapped arrangement is useful when adding tab pages.</li>
</ul>

<ul>
  <i>
  <li>Growth or Alignment</i>. A group can be allowed to grow or to align a specific way both
    horizontally and vertically. Generic groups inherit the growth properties of their child
    groups. If the children can grow, then the generic group grows as well. If the children
    can&#146;t grow, then the generic group will be aligned as its flags specify. The minimum
    size of window groups are defined by their size in the resource file.</li>
</ul>

<ul>
  <i>
  <li>Weight</i>. Each group has a weight that determines how much of the extra space gets
    assigned to that group relative to all sibling groups. The weight is applied equally to
    both the vertical and horizontal extra space and is ignored for groups that cannot grow.
    If you have three child groups, each with a weight of 1, then each group gets 1 / 3 of the
    total extra space. If you have three child groups, two with a weight of 1 and the last
    with a weight of 2, then the first two get 1 / 4 of the total extra space and the last
    gets 1 / 2 of the total extra space.</li>
</ul>

<blockquote>
  <p>Group Extra Space = Total Extra Space * Group Weight / Total Sibling Group Weight</p>
</blockquote>

<p>The layout starts out with a <i>top-level</i> group as the first control added to the
geometry manager. A top-level group is a dialog, an MDI child frame, or an SDI frame
window. All direct child groups are arranged horizontally, vertically or overlapped in the
order that they are added to the manager. This applies to children of any group. All
groups, except top-level groups, have a weight. Some groups are windows, while other
groups are simply placeholders for more child groups. In this way any layout desired can
be created.</p>

<p>The first function you should call is <a href="GmRegister.htm">GmRegister</a>. If you
have purchased GeometryManager, then you will pass your 16 character registration code
into this function to unlock the DLL. If you have not purchased GeometryManager, then this
function does nothing and simply returns false.</p>

<p>The geometry manager layout should be initialized after all child windows have been
created and before the window is shown. For dialogs, this is done in a <font face="Courier New">WM_INITDIALOG</font> message handler. For frame windows, this is done
in a <font face="Courier New">WM_INITIALUPDATE</font> message handler.</p>

<p>Let&#146;s look at a simple example dialog with one multi-line edit field and an
associated static text label, along with OK and Cancel buttons. The code and diagram will
speak for themselves.</font><b><font face="Arial"></p>

<p></font></b><font size="3">This is the example dialog in at its minimum size:</font></p>

<p><b><font face="Arial"><img src="images/Example1.jpg" alt="Example Dialog at Minimum Size" WIDTH="190" HEIGHT="168"></p>

<p></font></b>This is the example dialog sized a bit larger:</p>

<p><b><font face="Arial"><img src="images/Example2.jpg" alt="Example Dialog Sized Larger" WIDTH="653" HEIGHT="286"></p>

<h3>Layout Diagram</h3>

<p></font></b>This is a diagram of the groups that define the geometry of the example
dialog. Each of the rectangles represents one group.<font face="Arial"><b></p>

<p></b><img src="images/ExampleDiagram.gif" alt="Example Dialog Layout Diagram" WIDTH="482" HEIGHT="271"><b></p>

<h3>Source Code</b></font><font SIZE="2"></h3>

<p></font><font size="3">This code would appear in your handler for <font face="Courier New">WM_INITDIALOG</font>.<font face="Courier New"></p>
</font>

<p></font><font FACE="Courier New" SIZE="2">// initialize the geometry manager<br>
//<br>
// the default behavior is fine<br>
//<br>
HGEOM hGeom = GmStartDefinition(0);<br>
if (hGeom)<br>
{<br>
&nbsp;&nbsp;&nbsp; // add the top-level dialog group<br>
&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; // arrange its direct children vertically<br>
&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; HGMGROUP hTopDialog = GmAddTopDialog(hGeom, m_hWnd, GM_VERTICAL);<br>
&nbsp;&nbsp;&nbsp; if (hTopDialog)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the generic group for the static text
and edit field<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // arrange its direct children vertically<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // give it a weight of 1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HGMGROUP hGroup1 = GmAddGroup(hGeom,
hTopDialog, GM_VERTICAL, 1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (hGroup1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the static text
group<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // left-align and
vertically center it<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // give it a weight of
0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GmAddWnd(hGeom,
hGroup1, ::GetDlgItem(m_hWnd, IDC_SI_LABEL), GM_LEFT | GM_VCENTER, 0);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the multiline
edit field group<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // allow it to grow (in
both directions)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // give it a weight of
1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GmAddWnd(hGeom,
hGroup1, ::GetDlgItem(m_hWnd, IDC_SI), GM_GROW, 1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the generic group for the buttons<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // right-align it<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // arrange its direct children horizontally<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // give it a weight of 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hGroup1 = GmAddGroup(hGeom, hTopDialog,
GM_RIGHT | GM_HORIZONTAL, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (hGroup1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the two buttons<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // don't allow any
growth<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // give them a weight
of 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GmAddWnd(hGeom,
hGroup1, ::GetDlgItem(m_hWnd, IDOK), 0, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GmAddWnd(hGeom,
hGroup1, ::GetDlgItem(m_hWnd, IDCANCEL), 0, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; // end the definition and start the manager<br>
&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; GmEndDefinition(hGeom);<br>
}<br>
</font>
<!--msnavigation--></td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>

<p><br>
<small>Please send any technical questions to <a href="mailto:techsupport@stonehorse.com">techsupport@stonehorse.com</a><br>
Copyright 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?