void ShowPreviewDialogButton_Click (object sender, EventArgs e) { PrintPreviewDialog ppd = new PrintPreviewDialog (); ppd.ClientSize = new Size (400, 300); ppd.Location = new Point (29, 29); ppd.MinimumSize = new Size (375, 250); ppd.UseAntiAlias = true; ppd.Document = new MyPrintDocument (); ppd.ShowDialog (); }
private void PrintOut(string data, bool file, bool prview) { try { using (streamToPrint = file ? (TextReader)new StreamReader (data) : (TextReader)new StringReader(data)) { printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintPageRoutine); if (prview) { PrintPreviewDialog dlg = new PrintPreviewDialog(); dlg.Document = pd; dlg.ShowDialog(); } else pd.Print(); } } catch(Exception ex) { MessageBox.Show(ex.Message); } }
public PrintPreviewUIPrintController(PrintController underlyingController, PrintPreviewDialog owner) { this._underlyingController = underlyingController; this._owner = owner; }
/* * if (bingoTable.printCallList == true) { printBingoCallList(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo, "Oranges are pink", false); //print the call list here - msk } bingoTable.RandSeed = 0; * */ public BingoPrint() { printBingoDocument = new PrintDocument(); //printCallList = new PrintDocument(); printBingoPreviewDialog = new PrintPreviewDialog(); printBingoDialog = new PrintDialog(); pageBingoSetupDialog = new PageSetupDialog(); PrintPageSettings = new PageSettings(); printBingoDocument.PrintPage += new PrintPageEventHandler(this.PrintPage); // printCallList.PrintPage += new PrintPageEventHandler(this.PrintCallList); //printBingoDocument.QueryPageSettings += new QueryPageSettingsEventHandler(this.QueryPageSettings); numCardsToPrint = 0; return; }
public void PrintPreview(string name) { SourceCodePrintDocument printDocument = getPrintDocument(name); PrintPreviewDialog printPreview = new PrintPreviewDialog() { Document = printDocument, ShowIcon = false }; printPreview.ShowDialog(); }
/// <summary> /// 打印预览 /// </summary> /// <param name="dt">要打印的DataTable</param> /// <param name="Title">打印文件的标题</param> public string PrintPriview(DataTable dt, string Title, string paixudanhao, string dayinjimingcheng, params string[] chada) { var re = ""; try { options = new EncodingOptions { //DisableECI = true, //CharacterSet = "UTF-8", Width = 300, Height = 60 }; writer = new BarcodeWriter(); writer.Format = BarcodeFormat.CODE_128; writer.Options = options; Bitmap bitmap = writer.Write(paixudanhao.ToString()); img = Image.FromHbitmap(bitmap.GetHbitmap()); string paixudanhao_abc = GetImage_abc(dt); if (paixudanhao_abc.Length > 78) { paixudanhao_abc = paixudanhao_abc.Substring(0, 78); } options = new EncodingOptions { Width = 100, Height = 100 }; writer = new BarcodeWriter(); writer.Format = BarcodeFormat.QR_CODE; writer.Options = options; Bitmap bitmap_abc = writer.Write(paixudanhao_abc); img_abc = Image.FromHbitmap(bitmap_abc.GetHbitmap()); } catch (Exception a) { re = "f"; } try { PrintPreviewDialog PrintPriview = new PrintPreviewDialog(); PrintPriview.Document = CreatePrintDocument(dt, Title, dayinjimingcheng, chada); PrintPriview.WindowState = FormWindowState.Maximized; PrintPriview.ShowDialog(); //在这里将数据插入到数据里 //拼写sql语句 入库就ok } catch (Exception ex) { MessageBox.Show(ex.Message); System.Web.HttpContext.Current.Response.Redirect("../Edit/" + paixudanhao); re = "f"; } if (re.Equals("f")) { return("f"); } else { return("s"); } }
InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Parameters)); this.m_tvObjs = new System.Windows.Forms.TreeView(); this.m_cntxMenuObjId = new System.Windows.Forms.ContextMenu(); this.m_mnuItemCopy = new System.Windows.Forms.MenuItem(); this.m_mnuItemBrowseReflection = new System.Windows.Forms.MenuItem(); this.m_bnOK = new System.Windows.Forms.Button(); this.m_lvData = new System.Windows.Forms.ListView(); this.m_lvCol_label = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.m_lvCol_value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.listViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.m_bnParamEnums = new System.Windows.Forms.Button(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.m_printDialog = new System.Windows.Forms.PrintDialog(); this.m_printDocument = new System.Drawing.Printing.PrintDocument(); this.m_printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog(); this.m_bnParamEnumsMap = new System.Windows.Forms.Button(); this.listViewContextMenuStrip.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // m_tvObjs // this.m_tvObjs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.m_tvObjs.ContextMenu = this.m_cntxMenuObjId; this.m_tvObjs.HideSelection = false; this.m_tvObjs.Location = new System.Drawing.Point(11, 38); this.m_tvObjs.Name = "m_tvObjs"; this.m_tvObjs.Size = new System.Drawing.Size(248, 415); this.m_tvObjs.TabIndex = 0; this.m_tvObjs.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeNodeSelected); this.m_tvObjs.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.TreeNodeSelected); // // m_cntxMenuObjId // this.m_cntxMenuObjId.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.m_mnuItemCopy, this.m_mnuItemBrowseReflection }); // // m_mnuItemCopy // this.m_mnuItemCopy.Index = 0; this.m_mnuItemCopy.Text = "Copy"; this.m_mnuItemCopy.Click += new System.EventHandler(this.ContextMenuClick_Copy); // // m_mnuItemBrowseReflection // this.m_mnuItemBrowseReflection.Index = 1; this.m_mnuItemBrowseReflection.Text = "Browse Using Reflection..."; this.m_mnuItemBrowseReflection.Click += new System.EventHandler(this.ContextMenuClick_BrowseReflection); // // m_bnOK // this.m_bnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.m_bnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.m_bnOK.FlatStyle = System.Windows.Forms.FlatStyle.System; this.m_bnOK.Location = new System.Drawing.Point(476, 459); this.m_bnOK.Name = "m_bnOK"; this.m_bnOK.Size = new System.Drawing.Size(75, 23); this.m_bnOK.TabIndex = 2; this.m_bnOK.Text = "OK"; // // m_lvData // this.m_lvData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.m_lvData.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.m_lvCol_label, this.m_lvCol_value }); this.m_lvData.ContextMenuStrip = this.listViewContextMenuStrip; this.m_lvData.FullRowSelect = true; this.m_lvData.GridLines = true; this.m_lvData.Location = new System.Drawing.Point(275, 38); this.m_lvData.Name = "m_lvData"; this.m_lvData.Size = new System.Drawing.Size(504, 415); this.m_lvData.TabIndex = 3; this.m_lvData.UseCompatibleStateImageBehavior = false; this.m_lvData.View = System.Windows.Forms.View.Details; this.m_lvData.Click += new System.EventHandler(this.DataItemSelected); this.m_lvData.DoubleClick += new System.EventHandler(this.DataItemSelected); // // m_lvCol_label // this.m_lvCol_label.Text = "Field"; this.m_lvCol_label.Width = 200; // // m_lvCol_value // this.m_lvCol_value.Text = "Value"; this.m_lvCol_value.Width = 800; // // listViewContextMenuStrip // this.listViewContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.copyToolStripMenuItem }); this.listViewContextMenuStrip.Name = "listViewContextMenuStrip"; this.listViewContextMenuStrip.Size = new System.Drawing.Size(103, 26); // // copyToolStripMenuItem // this.copyToolStripMenuItem.Image = global::RevitLookup.Properties.Resources.Copy; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22); this.copyToolStripMenuItem.Text = "Copy"; this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); // // m_bnParamEnums // this.m_bnParamEnums.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.m_bnParamEnums.Location = new System.Drawing.Point(11, 459); this.m_bnParamEnums.Name = "m_bnParamEnums"; this.m_bnParamEnums.Size = new System.Drawing.Size(130, 23); this.m_bnParamEnums.TabIndex = 4; this.m_bnParamEnums.Text = "Built-in Enums Snoop..."; this.m_bnParamEnums.UseVisualStyleBackColor = true; this.m_bnParamEnums.Click += new System.EventHandler(this.OnBnEnumSnoop); // // toolStrip1 // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButton1, this.toolStripButton2, this.toolStripButton3 }); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(800, 25); this.toolStrip1.TabIndex = 5; this.toolStrip1.Text = "toolStrip1"; // // toolStripButton1 // this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton1.Image = global::RevitLookup.Properties.Resources.Print; this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Size = new System.Drawing.Size(23, 22); this.toolStripButton1.Text = "Print"; this.toolStripButton1.Click += new System.EventHandler(this.PrintMenuItem_Click); // // toolStripButton2 // this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton2.Image = global::RevitLookup.Properties.Resources.Preview; this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton2.Name = "toolStripButton2"; this.toolStripButton2.Size = new System.Drawing.Size(23, 22); this.toolStripButton2.Text = "Print Preview"; this.toolStripButton2.Click += new System.EventHandler(this.PrintPreviewMenuItem_Click); // // toolStripButton3 // this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton3.Image = global::RevitLookup.Properties.Resources.Copy; this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton3.Name = "toolStripButton3"; this.toolStripButton3.Size = new System.Drawing.Size(23, 22); this.toolStripButton3.Text = "Copy To Clipboard"; this.toolStripButton3.Click += new System.EventHandler(this.ContextMenuClick_Copy); // // m_printDialog // this.m_printDialog.Document = this.m_printDocument; this.m_printDialog.UseEXDialog = true; // // m_printDocument // this.m_printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocument_PrintPage); // // m_printPreviewDialog // this.m_printPreviewDialog.AutoScrollMargin = new System.Drawing.Size(0, 0); this.m_printPreviewDialog.AutoScrollMinSize = new System.Drawing.Size(0, 0); this.m_printPreviewDialog.ClientSize = new System.Drawing.Size(400, 300); this.m_printPreviewDialog.Document = this.m_printDocument; this.m_printPreviewDialog.Enabled = true; this.m_printPreviewDialog.Icon = ((System.Drawing.Icon)(resources.GetObject("m_printPreviewDialog.Icon"))); this.m_printPreviewDialog.Name = "m_printPreviewDialog"; this.m_printPreviewDialog.Visible = false; // // m_bnParamEnumsMap // this.m_bnParamEnumsMap.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.m_bnParamEnumsMap.Location = new System.Drawing.Point(153, 459); this.m_bnParamEnumsMap.Name = "m_bnParamEnumsMap"; this.m_bnParamEnumsMap.Size = new System.Drawing.Size(130, 23); this.m_bnParamEnumsMap.TabIndex = 6; this.m_bnParamEnumsMap.Text = "Built-in Enums Map..."; this.m_bnParamEnumsMap.UseVisualStyleBackColor = true; this.m_bnParamEnumsMap.Click += new System.EventHandler(this.OnBnEnumMap); // // Parameters // this.AcceptButton = this.m_bnOK; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.CancelButton = this.m_bnOK; this.ClientSize = new System.Drawing.Size(800, 489); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.m_bnParamEnumsMap); this.Controls.Add(this.m_bnParamEnums); this.Controls.Add(this.m_lvData); this.Controls.Add(this.m_bnOK); this.Controls.Add(this.m_tvObjs); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(650, 200); this.Name = "Parameters"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Snoop Parameters"; this.listViewContextMenuStrip.ResumeLayout(false); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
public static void Print_DataGridView(DataGridView dgv1) { PrintPreviewDialog ppvw; try { // 使用的DataGridView对象打印(&P) dgv = dgv1; // 在DataGridView获取所有Coulmns名称 AvailableColumns.Clear(); foreach (DataGridViewColumn c in dgv.Columns) { if (!c.Visible) { continue; } AvailableColumns.Add(c.HeaderText); } // 显示打印(&P)设置窗体 frmOther.frmPrintSet dlg = new CMS.UILayer.frmOther.frmPrintSet(AvailableColumns); //PrintOptions dlg = new PrintOptions(AvailableColumns); if (dlg.ShowDialog() != DialogResult.OK) { return; } PrintTitle = dlg.PrintTitle; PrintAllRows = dlg.PrintAllRows; FitToPageWidth = dlg.FitToPageWidth; SelectedColumns = dlg.GetSetlectedColumns(); RowsPerPage = 0; ppvw = new PrintPreviewDialog(); ppvw.Document = printDoc; // Showing the Print Preview Page printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); if (ppvw.ShowDialog() != DialogResult.OK) { printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); return; } // 打印(&P)对话框 printDoc.Print(); printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { } }
private void izbornikPrintPreview_Click(object sender, EventArgs e) { PrintPreviewDialog ppDialog = new PrintPreviewDialog(); ppDialog.ShowDialog(); }
private void unesi_Click(object sender, EventArgs e) { try { DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); // slika = new Bitmap(defaultpic); if (tabControl1.SelectedIndex == 0) { if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || prezime.Text.Length < 1 || jmbg.Text.Length < 1 || telefon.Text.Length < 1) { toolStripStatusLabel1.Text = "Popunite sva polja"; } else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && provjeriJMBG(jmbg.Text) && prezime.Text.Length < 45 && IspravanIndeks(index.Text)) { Uposlenik u = new Uposlenik(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), jmbg.Text, tipUposlenika.Text); u.Slika = (Bitmap)naslovnaStrana.Image; dao.DodajUposlenika(u); PrintPreviewDialog previewDialog = new PrintPreviewDialog(); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj); previewDialog.Document = pd; previewDialog.SetBounds(50, -550, 200, 200); previewDialog.ShowDialog(); toolStripStatusLabel1.Text = ""; ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text = ""; faks.SelectedIndex = 1; clanarina.SelectedIndex = 1; tipUposlenika.SelectedIndex = 1; naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon)); // )); toolStripStatusLabel1.Text = "Korisnik dodan"; } else { toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!"; } } if (tabControl1.SelectedIndex == 1) { if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || index.Text.Length < 1 || prezime.Text.Length < 1) { toolStripStatusLabel1.Text = "Popunite sva polja"; } else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && index.Text.Length < 11 && prezime.Text.Length < 45) { Student s = new Student(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), Convert.ToInt16(index.Text), faks.Text, Convert.ToInt32(clanarina.Text)); s.Slika = (Bitmap)naslovnaStrana.Image; dao.DodajStudenta(s); if (tabControl1.SelectedIndex == 1) { student = true; } if (tabControl2.SelectedIndex == 5) { Image camera = Image.FromFile("capture.png"); slika = new Bitmap(camera); } PrintPreviewDialog previewDialog = new PrintPreviewDialog(); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj); previewDialog.Document = pd; previewDialog.SetBounds(50, -550, 200, 200); previewDialog.ShowDialog(); ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text = ""; faks.SelectedIndex = 1; clanarina.SelectedIndex = 1; tipUposlenika.SelectedIndex = 1; naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon)); toolStripStatusLabel1.Text = "Korisnik dodan"; } else { toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!"; } } } catch (Exception izuzetak) { MessageBox.Show(izuzetak.Message); } }
private void button_print_Click(object sender, EventArgs e) { PrintPreviewDialog printPreview = new PrintPreviewDialog(); grid_Calendar.ShowPrintPreview(); }