// In this example, the common table printing 1 or 2 is required, and the interface is used together with code128 barcode generation.
Sing system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. LINQ;
Using system. text;
Using system. Windows. forms;
Using cyh. General;
Namespace demotablexreport
{
Public partial class form1: Form
{
Private dataset dataset1;
Public form1 ()
{
Initializecomponent ();
}
Private void form1_load (Object sender, eventargs E)
{
// Read data to Dataset
Dataset1 = new dataset ();
Dataset1.readxml (application. startuppath + "\ testreport. xml", system. Data. xmlreadmode. readschema );
Datagridview1.datasource = dataset1;
Datagridview1.datamember = dataset1.tables [0]. tablename;
}
Private void button#click (Object sender, eventargs E)
{
Itablereport XTR = new ctltablereport ();
XTR. addreporttitle ("test 1 (center)", true, null, stringalignment. Center, size. Empty );
XTR. addreporttitle ("test 2 (FAR)", true, null, stringalignment. Far, size. Empty );
XTR. addreporttitle ("test 1 (center)", false, null, stringalignment. Center, size. Empty );
XTR. addreporttitle ("test 2 (near) {0}", false );
XTR. addreportfield ("part number", null, "drug catalog", stringalignment. Near, null, false, String. Empty, true, String. Empty, size. Empty );
XTR. addreportfield ("name", "name ");
XTR. addreportfield ("gauge 2", null, "type", stringalignment. Near, null, false, "Total", false, String. Empty, size. Empty );
XTR. addreportfield ("zero price 3", null, "retail price", stringalignment. far, null, false, "", true, "{0: #0.00}", size. empty );
XTR. setreportbarcode ("a202010", new point (100, 0), new size (500,100), true, String. Empty );
// Int r = XTR. getautorow (dataset1.tables [0]. Rows. Count, 40 );
// XTR. setreportmain (100, R, reportgridline. nothing, stringalignment. center, false, new system. drawing. printing. margins (80, 80,100, 80), system. drawing. printing. paperkind. custom, size. empty, 1, 0, "", true, 1 );
XTR. setreportmain (100, 20, reportgridline. nothing, stringalignment. center, false, new system. drawing. printing. margins (80, 80,100, 80), system. drawing. printing. paperkind. custom, size. empty, 1, 0, "", false, 1 );
XTR. unitafterprint + = new reportunitafterprint (xtr_unitafterprint );
XTR. datasource = dataset1.tables [0];
XTR. showdialog ();
}
Void xtr_unitafterprint (Object sender, reportbandtype source, int pageindex, int rowindex, string caption, string field, ref string value, eventargs E)
{
// If (Source = reportbandtype. pagefooder)
// Value = string. Format ("{0}", pageindex + 1 );
// Throw new notimplementedexception ();
}
Void xtr_unitafterprint (Object sender, int source, int pageindex, int rowindex, string caption, string field, ref string value, eventargs E)
{
// Print content and format can be corrected here
}
}
}