void EndPrint() { if (this.document != null) { this.document.Close(); this.document = null; } }
// parameters: // strCardFilename 卡片文件名 int BeginPrint( string strCardFilename, out string strError) { strError = ""; if (String.IsNullOrEmpty(strCardFilename) == true) { strError = "尚未指定卡片文件名"; return -1; } if (this.document != null) { this.document.Close(); this.document = null; } this.document = new PrintCardDocument(); this.document.Stop = false; this.document.SetProgress -= new SetProgressEventHandler(document_SetProgress); this.document.SetProgress += new SetProgressEventHandler(document_SetProgress); int nRet = this.document.Open(strCardFilename, out strError); if (nRet == -1) return -1; this.document.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage); this.document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage); if (this.checkBox_testingGrid.Checked == true) this.m_strPrintStyle = "TestingGrid"; else this.m_strPrintStyle = ""; return 0; }