📄 vcg09.htm
字号:
<H5 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Generating Bitmaps with Desktop Publishing Packages</B></FONT></CENTER></H5>
<BR>
<P>Many full-featured vector-based drawing packages are available. Most include a variety of clip-art images that you can use (or adapt for use) as button faces in your applications. Some desktop publishing applications have several thousand clip art images on their CDs. In addition, you can purchase CDs packed with nothing but various clip-art images.
<BR>
<P>When you open an icon or clip-art image in a commercial publishing package, the image is typically much larger than you need or want for a button bitmap. Generally, you must reduce the image to create a bitmap that is approximately .25-inch high. Add a light gray background to the image so that the background matches the default background color of Visual Basic buttons. You'll probably have to export the image from its original clip-art format, which is usually some type of vector drawing format rather than a bitmap. Export the image to a 16-color Windows bitmap (.BMP) file.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE><B>NOTE</B>
<BR>
<BR>The CD that comes with this book has an application called Paint Shop Pro, a full-featured graphics editor. Paint Shop Pro can work as well as some of the higher-priced products for most Visual C++ programmers.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<BR>
<A NAME="E68E57"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Displaying Detail Data with the WinWidgets HGrid Control</B></FONT></CENTER></H3>
<BR>
<P>The WinWidgets HGrid control lets Visual C++ display tabular detail with a graphical presentation.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE><B>NOTE</B>
<BR>
<BR>It may well be easier to use the ListView Win32 Common Control to display tabular data. Another alternative is the grid OLE Custom Control, which is also shipped with Visual C++ 4. Each method presents advantages and disadvantages to the programmer.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>The HGrid control can't be linked to a recordset object directly. However, you can write a simple Visual C++ routine to display data created by the qryMonthlyProductSalesParam query from the Products table and the qryMonthlyProductSalesCrosstab query of DEC_SUPT.MDB. The SQL statements used to create the two QueryDef objects that you use to generate a Dynaset object (which you manipulate to supply data to the grid) are as follows:
<BR>
<PRE>
<FONT COLOR="#000080">TRANSFORM Sum(tblProductRollupMonth.Sales) AS SumOfSales
SELECT tblProductRollupMonth.[Product ID]
FROM tblProductRollupMonth
GROUP BY tblProductRollupMonth.[Product ID]
PIVOT tblProductRollupMonth.Month
IN ("01","02","03","04","05","06","07","08","09","10","11","12");
PARAMETERS CategID Text;
SELECT Products.[Product ID], Products.[Product Name],
[01], [02], [03], [04], [05], [06], [07], [08], [09], [10], [11], [12]
FROM qryMonthlyProductSalesCrosstab, Products,
qryMonthlyProductSalesCrosstab RIGHT JOIN Products ON
qryMonthlyProductSalesCrosstab.[Product ID] =
Products.[Product ID]
WHERE Products.[Category ID]=CategID;</FONT></PRE>
<P>The TRANSFORM (crosstab) query creates a Dynaset object that consists of the Product ID column and 12 monthly columns labeled 01 through 12. One row is created for each product. The IN predicate is added to assure that the query returns 12 columns, even if no data is available for all of the months of the year. The SQL SELECT statement uses the Dynaset object created by the Access SQL TRANSFORM statement as if the Dynaset were a persistent table.
<BR>
<P>The purpose of the parameterized SELECT query is to assure that all rows for products within a category designated by the CategID parameter appear in the resulting dynaset, regardless of whether sales of the product occurred during the year, and to supply a column containing the name of the product. A RIGHT JOIN is needed to make all of the products in the category appear. You need to use Access SQL for the JOIN statement because the Access database engine doesn't recognize the ANSI SQL =* operator that designated a right join.
<BR>
<P>A detailed explanation of the WinWidgets package is beyond the scope of this book, but Table 9.1 lists some of the features that this package offers.
<BR>
<BR>
<P ALIGN=CENTER>
<CENTER>
<FONT COLOR="#000080"><B>Table 9.1. Features of the WinWidgets package.</B></FONT></CENTER>
<BR>
<CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3 >
<TR>
<TD><FONT COLOR=#000080>
<I>Feature</I>
</FONT>
<TD><FONT COLOR=#000080>
<I>Description</I></FONT>
<TR>
<TD><FONT COLOR=#000080>
DataEngine
</FONT>
<TD><FONT COLOR=#000080>
A set of custom controls that format data, such as dates, time, and money, using supplied formatting.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HBUTT
</FONT>
<TD><FONT COLOR=#000080>
Supports button controls, including multiline text support.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HCOMB
</FONT>
<TD><FONT COLOR=#000080>
Support for a more powerful combo box control. Enhanced support for the programmer includes text attributes such as color and font.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HEDIT
</FONT>
<TD><FONT COLOR=#000080>
An edit control that is designed to let data be displayed, edited, and validated.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HGRID
</FONT>
<TD><FONT COLOR=#000080>
The grid control is a valuable tool that lets programmers display record data. Displayed data can be updated.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HLIST
</FONT>
<TD><FONT COLOR=#000080>
The HLIST list box control offers many of the features of the HCOMB combo-box control.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HSPIN
</FONT>
<TD><FONT COLOR=#000080>
The HSPIN control is an edit control with a pair of additional buttons that let the user increment or decrement the value displayed in the edit control. Often used with numeric data, the HSPIN control can be used with text-based data, as well (such as selecting from a list of colors).</FONT>
<TR>
<TD><FONT COLOR=#000080>
HSTAT
</FONT>
<TD><FONT COLOR=#000080>
The HSTAT control is used to display bitmaps, text, icons, and frames.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HTAB
</FONT>
<TD><FONT COLOR=#000080>
The HTAB control lets you create a type of tabbed dialog box. Because Visual C++ already supports tabbed dialog boxes, this control isn't useful for Visual C++ programmers.</FONT>
<TR>
<TD><FONT COLOR=#000080>
HTOOL
</FONT>
<TD><FONT COLOR=#000080>
The HTOOL toolbar control offers improvements over Visual C++ 1.x's toolbar support. However, users of Visual C++ 2.x and later will most likely find that the Visual C++ MFC toolbar classes are the preferred implementation.</FONT>
<TR>
<TD><FONT COLOR=#000080>
XTABLE
</FONT>
<TD><FONT COLOR=#000080>
The XTABLE control provides the basic functionality of a spreadsheet. This control can be most useful when you're developing applications in which users must update records in a datasource or where any spreadsheet-type operations must be performed.</FONT>
</TABLE></CENTER><BR>
<A NAME="E68E58"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>
<BR>
<P>This chapter introduced you to an almost-commercial Visual C++ database application, the first such application to be presented <A NAME="I2"></A>in this book. The table rollup, query design, and user interface guidelines discussed in this chapter can start you on your way to creating production-decision support applications with Visual C++. The forms included in the UI_EXAMP application are the basis of the designs of all of the decision-support examples in the following chapters.
<BR>
<P>This chapter demonstrated that you can create an attractive and quite functional Visual C++ database decision-support application with relatively little code. The next chapter shows you how to add additional functionality to your decision-support applications with data-aware control objects and more sophisticated coding techniques.
<P ALIGN=CENTER>
<A HREF="vcgp3.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcgp3.htm" TARGET="_self"><IMG SRC="blanprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blanprev.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Previous Page"></A>
<A HREF="#I0" TARGET="_self"><IMG SRC="blantop.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantop.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Page Top"></A>
<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/index.htm" TARGET="_self"><IMG SRC="blantoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantoc.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="TOC"></A>
<A HREF="vcg10.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcg10.htm" TARGET="_self"><IMG SRC="blannext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blannext.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Next Page"></A>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -