private void ButtonPrint_Click(object sender, EventArgs e) { //PrintPreviewVoucher.Document = PrintDocumentVoucher; //PrintPreviewVoucher.Size = new System.Drawing.Size(420, 595); //PrintPreviewVoucher.ShowDialog(); using (var dlg = new CoolPrintPreviewDialog(null)) { dlg.Document = PrintDocumentVoucher; dlg.ShowDialog(this); } }
/* private void TextBoxCusName_TextChanged(object sender, EventArgs e) * { * try * { * ClassDatabaseConnection DatabaseConnectObj = new ClassDatabaseConnection(); * try * { * DataTable dt = new DataTable(); * string[] substring = TextBoxCusName.Text.Split('('); * substring = substring[1].Split(')'); * DatabaseConnectObj.SqlQuery("SELECT CustomerNo, VehicleNo, VehicleType FROM Customer WHERE (VehicleNo = '" + substring[0].Trim() + "')"); * dt = DatabaseConnectObj.ExecuteQuery(); * DataRow row = dt.Rows[0]; * string temp = row["CustomerNo"].ToString() + "\n" + row["VehicleNo"].ToString() + "\n" + row["VehicleType"].ToString(); * LabelHidden.Text = temp; * ComboBoxProduct.Text = row["VehicleType"].ToString(); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * } * finally * { * DatabaseConnectObj.DatabaseConnectionClose(); * } * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * } * } */ private void ButtonUpdate_Click(object sender, EventArgs e) { /*PrintPreviewInvoice.Document = PrintDocumentInvoice; * PrintPreviewInvoice.Size = new System.Drawing.Size(595, 842); * PrintPreviewInvoice.ShowDialog();*/ //PrintPreview PrintPreviewForm = new PrintPreview(PrintDocumentInvoice1, TextBoxTotal.Text); //PrintPreviewForm.ShowDialog(); using (var dlg = new CoolPrintPreviewDialog(null, TextBoxTotal.Text, LabelHidden.Text)) { dlg.Document = PrintDocumentInvoice1; dlg.ShowDialog(this); } }