\delphi 6 Typical instance of database development \ Chart Drawing
1. Open the subform in the main form: ShowForm (Tfrm_print);
Procedure Tfrm_main.showform (Aformclass:tformclass);
Begin
With Aformclass.create (self) do
Try
ShowModal; Block or modal window, you can only go to the Father window after you close the current window.
Finally
Free;
End
End
This example opens with an exception, prompting the unit chart reference itself,
Because the project is named Program Chart, and the control class name used is Tchart conflict,
Change the project name to program MyChart; Compile.
2, print pie chart;
1 Implementation2 usesprinters;3 {$R *.DFM}4 5 procedureTfrm_print.btn_printclick (sender:tobject);6 varH,w:longint;7 begin8Screen.cursor: =Crhourglass;9 TryTen Printer.begindoc; One Try Ah:=Printer.pageheight; -w:=Printer.pagewidth; - theChart1.printpartial (Rect (wDiv Ten, -HDiv 3 , -W-(WDiv Ten), -H-(hDiv Ten) )); + - Printer.enddoc; + except AOn Exception Do at begin - Printer.abort; - Printer.enddoc; - Raise; - End; - End; in finally -screen.cursor:=Crdefault; to End; + End;
Print pie chart
Main form Open Subform && Print pie chart "Typical example of Delphi 6 database Development"--chart drawing