Produce Chinese statement with Delphi
In database application development, an important issue for system designers and programmakers need to consider how to design and output reports. In Delphi, we can use multiple programs to solve this problem. If you use OLE Automation to output data to MS-Word, MS-Excel, but most direct, most local or use QuickReport report components in Delphi3.0 / 40. It is written in Delphi, Norwegian Qusoft, using QuickReport to quickly design reports that meet Western habits. However, when designing a Chinese statement, the author found that the vertical line and slash between the columns and columns in QuickReport; although QuickReport provides Tqshape controls, use this control to draw vertical lines between columns and columns However, if the user does not correctly adjust the height of the Tqshape instance, the vertical line in the output report is not continuous, and if we adjust the height of a BAN, we will have to adjust all TQShape instances under this band. Height; as for slant lines, QuickReport report components do not provide this feature. The author carefully found relevant information, successfully solved the above problems, hoping to help everyone. Solving the idea with tQshape as the parent class, establish new controls, new controls can draw vertical lines, slashes, and backlash. The PAINT method of the TQShape class is overloaded, so that it can be very intuitive in the design phase. The user can select the type of the line in the design phase. If the line is selected, the control is automatically adjusted to the height of the BAND, and the user can adjust its lateral position but cannot adjust its height; if the slash, the user can adjust the slash as needed. Length and inclination. The Print method of the TQShape class is overloaded, which can output a straight line and the slash at the run phase. Description: This control can only draw straight and slashes. If the reader needs to draw a rectangle and circle, you can use the TQShape control to be implemented. Control Design Steps Step 1. Use the control wizard provided by Delphi, select Tqshape to create a new class TMYQRSHAPE, and select the appropriate package (package), and finalize unit files. Step 2. In the generated unit file, add an enumerated type. TLINES = (None, Topbottom, Bottomtop) None, TopBottom, Bottomtop, three types of values, represents straight, slash / and backslash /. Step 3. Increase the private member flinetype: tLINETYPE: TLINES Read FlineType Write SetFLINETYPE in the new class TMYQRSHAPE. Step 4. Establish a process setFLINETYPE. ProceduretMyQRShape.setflineType (Value: TLINES); Beginif value <> FlineType ThenbeginflineType: = value invalidate End End Step 5. Reloading the PAINT method. procedure TMyQRShape.Paint begincase LineType ofBottomTop: beginCanvas.MoveTo (0, Height) Canvas.LineTo (width, 0) end TopBottom: beginCanvas.MoveTo (0,0) Canvas.LineTo (width, Height) end None: beginHeight: = Parent .Height top: = 0 width: = 4 Shape: = Qrsvertline Inherited Paint End end END END END END END END END END END END METERT.
procedure TMyQRShape.Print (OfsX, OfsY: Integer); beginwith QRPrinter dobegincase LineType ofBottomTop: beginCanvas.MoveTo (XPos (OfsX Size.Left), YPos (OfsY Size.Top) Height) Canvas.LineTo (XPos (OfsX Size.Left) Width, Ypos (OFSY SIZE.TOP) End Topbottom: BegIncanvas.moveto (xpos (OFSX Size.Left), Ypos (OFSY SIZE.TOP)) Canvas.Lineto (XPOS (oX size Leved width, ypos (OFSY SIZE.TOP) Height) End None: Inherited Print (OFSX, OFSY) End end; Step 7. Save and install the TMYQRSHAPE control. This control is debugged, installs, and successfully applied to the development of a database management system under Delphi40.