📄 137-140.html
字号:
<!-- END SUB HEADER -->
<!--Begin Content Column -->
<FONT FACE="Arial,Helvetica" SIZE="-1">
To access the contents, click the chapter and section titles.
</FONT>
<P>
<B>Essential Windows CE Application Programming</B>
<FONT SIZE="-1">
<BR>
<I>(Publisher: John Wiley & Sons, Inc.)</I>
<BR>
Author(s): Robert Burdick
<BR>
ISBN: 0471327476
<BR>
Publication Date: 03/01/99
</FONT>
<P>
<form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi">
<INPUT TYPE="hidden" NAME="Action" VALUE="Search">
<INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm">
<INPUT TYPE="hidden" NAME="Collection" VALUE="ITK">
<INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-simple-intrabook.hts">
<INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts">
<font face="arial, helvetica" size=2><b>Search this book:</b></font><br>
<INPUT NAME="queryText" size=50 VALUE=""> <input type="submit" name="submitbutton" value="Go!">
<INPUT type=hidden NAME="section_on" VALUE="on">
<INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471327476/">
</form>
<!-- Empty Reference Subhead -->
<!--ISBN=0471327476//-->
<!--TITLE=Essential Windows CE Application Programming//-->
<!--AUTHOR=Robert Burdick//-->
<!--PUBLISHER=John Wiley & Sons, Inc.//-->
<!--IMPRINT=Wiley Computer Publishing//-->
<!--CHAPTER=5//-->
<!--PAGES=137-140//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="132-137.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="140-144.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>Creating Rebar Controls</B></FONT></P>
<P>A rebar control is created using the REBARCLASSNAME control class.
</P>
<P>The control is created with the following <I>CreateWindow</I> call. <I>hwndMain</I> and <I>hInstance</I> are the main application window and the application HINSTANCE, respectively.</P>
<!-- CODE SNIP //-->
<PRE>
#define IDC_REBAR 1024
HWND hwndRebar;
hwndRebar = CreateWindow(REBARCLASSNAME, NULL,
WS_CHILD|WS_VISIBLE|WS_BORDER|
RBS_VARHEIGHT|RBS_BANDBORDERS,
0,0,0,0,
hwndMain, (HMENU)IDC_REBAR,
hInstance,NULL);
</PRE>
<!-- END CODE SNIP //-->
<P>As was the case with the month calendar control, the <I>x</I>, <I>y</I>, <I>nWidth</I>, and <I>nHeight</I> parameters can be set to zero. The dimensions of the bands are what really matter, and these are inserted after the rebar control is created.</P>
<P><FONT SIZE="+1"><B>Rebar Control Bands</B></FONT></P>
<P>Bands are the real nucleus of a rebar control. The bands are what contain the child controls and define the appearance of the rebar control.
</P>
<P>To fully understand bands, we must first look at how Windows CE represents bands. We can then explore how to add bands to rebar controls.</P>
<P><FONT SIZE="+1"><B><I>The REBARBANDINFO Structure</I></B></FONT></P>
<P>All information describing a band is specified in terms of a REBARBANDINFO structure. REBARBANDINFO information is supplied by applications when inserting bands into rebar controls. It can also be queried by an application to get information about existing rebar control bands. The structure is defined as:
</P>
<!-- CODE //-->
<PRE>
typedef struct tagREBARBANDINFO
{
UINT cbSize;
UINT fMask;
UINT fStyle;
COLORREF clrFore;
COLORREF clrBack;
LPTSTR lpText;
UINT cch;
int iImage;
HWND hwndChild;
UINT cxMinChild;
UINT cyMinChild;
UINT cx;
HBITMAP hbmBack;
UINT wID;
UINT cyChild;
UINT cyMaxChild;
UINT cyIntegral;
UINT cxIdeal;
LPARAM lParam;
} REBARBANDINFO, FAR* LPREBARBANDINFO;
</PRE>
<!-- END CODE //-->
<P><I>cbSize</I> just indicates the size of the REBARBANDINFO structure. Applications set this value using the <I>sizeof</I> function.</P>
<P>The rest of the members of this structure are used to describe various characteristics of a particular rebar band. Not all of the members are necessarily used. The <I>fMask</I> member defines which members are valid for a given instance of the structure. <I>fMask</I> can be one or more of the following values (the RBBIM prefix stands for “rebar band info mask”):</P>
<DL>
<DD><B>RBBIM_BACKGROUND.</B> Indicates that the <I>hbmBack</I> member is valid.
<DD><B>RBBIM_CHILD.</B> The <I>hwndChild</I> member is valid.
<DD><B>RBBIM_CHILDSIZE.</B> The <I>cxMinChild</I> and <I>cyMinChild</I> members are valid.
<DD><B>RBBIM_COLORS.</B> The <I>clrFore</I> and <I>clrBack</I> members are valid.
<DD><B>RBBIM_IDEALSIZE.</B> The <I>cxIdeal</I> member is valid.
<DD><B>RBBIM_ID.</B> The <I>wID</I> member is valid.
<DD><B>RBBIM_IMAGE.</B> The <I>iImage</I> member is valid.
<DD><B>RBBIM_LPARAM.</B> The <I>lParam</I> member is valid.
<DD><B>RBBIM_SIZE.</B> The <I>cx</I> member is valid.
<DD><B>RBBIM_STYLE.</B> The <I>fStyle</I> member is valid.
<DD><B>RBBIM_TEXT.</B> The <I>lpText</I> member is valid.
</DL>
<P>The <I>fStyle</I> member is used to specify various styles for the band in question. Just as the parent rebar control has a set of styles associated with it, each band in a rebar control can have its own style attributes. The <I>fStyle</I> member can be one or more of the following (the RBBS prefix stands for “rebar band style”):</P>
<DL>
<DD><B>RBBS_BREAK.</B> Indicates that the band is on a new line, i.e., in a new row.
<DD><B>RBBS_CHILDEDGE.</B> The band has an edge at the top and bottom.
<DD><B>RBBS_FIXEDBMP.</B> If the band has a background bitmap, the bitmap does not move when the band is resized.
<DD><B>RBBS_FIXEDSIZE.</B> The band cannot be moved/sized, and no gripper bar is displayed.
<DD><B>RBBS_GRIPPERALWAYS.</B> The band always displays a gripper bar, even if the RBBS_FIXEDSIZE style is set.
<DD><B>RBBS_HIDDEN.</B> Makes the band invisible.
<DD><B>RBBS_NOVERT.</B> The band will not be displayed if the parent rebar control uses the CCS_VERT style.
<DD><B>RBBS_VARIABLEHEIGHT.</B> The band can be resized by the rebar control. The <I>cyIntegral</I> and <I>cyMaxChild</I> members of the corresponding REBARBANDINFO structure control the resizing.
</DL>
<P>The <I>clrFore</I> and <I>clrBack</I> members specify the band’s foreground and background colors, respectively. These colors are ignored if the <I>hbmBack</I> member is valid.</P>
<P><I>lpText</I> contains the text label used with the band. <I>cch</I> specifies the size of <I>lpText</I> in bytes.</P>
<P><I>iImage</I> is the zero-based index of the image to display with the band. The rebar control must be using an image list in this case.</P>
<P>The <I>hwndChild</I> member specifies the HWND of the child control contained by the band. <I>cxMinChild</I> and <I>cyMinChild</I> specify the minimum width and height of the control. The band cannot be smaller than these values. Similarly, <I>cyMaxChild</I> specifies the maximum child control height, and hence the maximum band height. This value is ignored if the band does not have the RBBS_VARIABLEHEIGHT style. <I>cx</I> specifies the width of the band. <I>cyChild</I> specifies the initial height of the band. It is also ignored if RBBS_VARIABLEHEIGHT is not set.</P>
<P>The <I>hbmBack</I> member specifies a bitmap to use as the band background.</P>
<P><I>wID</I> is used to identify the band in Custom Draw notifications.</P>
<P>The <I>cyIntegral</I> member defines the smallest number of pixels that the band grows or shrinks when resized. This member is ignored if the band does not have the RBBS_VARIABLEHEIGHT style.</P>
<P><I>cxIdeal</I> specifies the ideal band width. If the band is maximized to its ideal width via the RB_MAXIMIZEBAND message, the rebar control tries to make the band this size.</P>
<P>Finally, <I>lParam</I> is a 32-bit value which the application can use to store any other application-defined information with the corresponding rebar control band.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="132-137.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="140-144.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- BEGIN SUB FOOTER -->
<br><br>
</TD>
</TR>
</TABLE>
<table width="640" border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>
<!-- END SUB FOOTER -->
<!-- all of the books have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- FOOTER -->
<td width="515" align="left" bgcolor="#FFFFFF">
<font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a> | <a href="/contactus.html"><font color="#006666">Contact Us</font></a> | <a href="/aboutus.html"><font color="#006666">About Us</font></a> | <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> | <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> | <a href="/"><font color="#006666">Home</font></a></b>
<br><br>
Use of this site is subject to certain <a href="/agreement.html">Terms & Conditions</a>, <a href="/copyright.html">Copyright © 1996-1999 EarthWeb Inc.</a><br>
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p>
</td>
</tr>
</table>
</BODY>
</HTML>
<!-- END FOOTER -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -