private void navPrint_Click(object sender, EventArgs e) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); bool CenterOnPage = true; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font("Arial Narrow", 14, FontStyle.Bold); Font fontPrintFooter = new Font("Times New Roman", 10); try { curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = true; curPrintDialog.UseEXDialog = true; curPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = true; if (curPrintDialog.ShowDialog() == DialogResult.OK) { String printTitle = Properties.Settings.Default.Mdi_Title + "\n Sanction " + mySanctionNum + " held on " + myTourRow["EventDates"].ToString() + "\n" + this.Text; myPrintDoc = new PrintDocument(); myPrintDoc.DocumentName = this.Text; myPrintDoc.DefaultPageSettings.Margins = new Margins(25, 25, 25, 25); myPrintDoc.DefaultPageSettings.Landscape = true; myPrintDataGrid = new DataGridViewPrinter(scoreSummaryDataGridView, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging); myPrintDataGrid.SubtitleList(); StringRowPrinter mySubtitle; StringFormat SubtitleStringFormat = new StringFormat(); SubtitleStringFormat.Trimming = StringTrimming.Word; SubtitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormat.Alignment = StringAlignment.Center; if (plcmtDivButton.Checked) { mySubtitle = new StringRowPrinter(TrickLabel.Text, 451, 0, 215, TrickLabel.Size.Height, TrickLabel.ForeColor, TrickLabel.BackColor, TrickLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; } else { mySubtitle = new StringRowPrinter(TrickLabel.Text, 486, 0, 215, TrickLabel.Size.Height, TrickLabel.ForeColor, TrickLabel.BackColor, TrickLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; } myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); } } catch (Exception ex) { MessageBox.Show("Exception encountered during print request" + "\n\nException: " + ex.Message); } }
private void navPrintResults_Click( object sender, EventArgs e ) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); DataGridView[] myViewList = new DataGridView[1]; myViewList[0] = slalomRecapDataGridView; bool CenterOnPage = false; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font( "Arial Narrow", 14, FontStyle.Bold ); Font fontPrintFooter = new Font( "Times New Roman", 10 ); curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = false; curPrintDialog.UseEXDialog = true; curPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = true; if ( curPrintDialog.ShowDialog() == DialogResult.OK ) { String printTitle = Properties.Settings.Default.Mdi_Title + " - " + this.Text; myPrintDoc = new PrintDocument(); String curDocName = ""; String curAgeGroup = (String)TourEventRegDataGridView.CurrentRow.Cells["AgeGroup"].Value; String curSkierName = (String)TourEventRegDataGridView.CurrentRow.Cells["SkierName"].Value; String[] curNameParts = curSkierName.Split( ',' ); if ( curNameParts.Length > 1 ) { curDocName = curNameParts[1].Trim() + curNameParts[0].Trim() + "_" + curAgeGroup; } else if ( curNameParts.Length == 1 ) { curDocName = curNameParts[1].Trim() + curNameParts[0].Trim() + "_" + curAgeGroup; } else { curDocName = "Unknown"; } curSkierName += " " + curAgeGroup; myPrintDoc.DocumentName = curDocName; myPrintDoc.DefaultPageSettings.Margins = new Margins( 125, 125, 25, 25 ); myPrintDoc.DefaultPageSettings.Landscape = true; myPrintDataGrid = new DataGridViewPrinter( myViewList, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging ); //Build titles for each data grid view myPrintDataGrid.GridViewTitleList(); StringRowPrinter myGridTitle; StringFormat GridTitleStringFormat = new StringFormat(); GridTitleStringFormat.Trimming = StringTrimming.Word; GridTitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; GridTitleStringFormat.Alignment = StringAlignment.Near; myGridTitle = new StringRowPrinter( "Slalom Pass Round " + roundSelect.RoundValue, 0, 20, 325, fontPrintTitle.Height, Color.DarkBlue, Color.White, fontPrintTitle, GridTitleStringFormat ); myPrintDataGrid.GridViewTitleRow = myGridTitle; //Build report page subtitles myPrintDataGrid.SubtitleList(); StringRowPrinter mySubtitle; StringFormat SubtitleStringFormatLeft = new StringFormat(); SubtitleStringFormatLeft.Trimming = StringTrimming.Word; SubtitleStringFormatLeft.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormatLeft.Alignment = StringAlignment.Near; StringFormat SubtitleStringFormatCenter = new StringFormat(); SubtitleStringFormatCenter.Trimming = StringTrimming.Word; SubtitleStringFormatCenter.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormatCenter.Alignment = StringAlignment.Center; mySubtitle = new StringRowPrinter( curSkierName, 0, 0, 325, fontPrintTitle.Height, Color.DarkBlue, Color.White, fontPrintTitle, SubtitleStringFormatLeft ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( scoreLabel.Text, 0, 25, 50, scoreLabel.Size.Height, Color.Black, Color.White, scoreLabel.Font, SubtitleStringFormatCenter ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( scoreTextBox.Text, 0, 40, 50, scoreTextBox.Size.Height, Color.Black, Color.White, scoreTextBox.Font, SubtitleStringFormatCenter ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( nopsScoreLabel.Text, 170, 25, 50, nopsScoreLabel.Size.Height, Color.Black, Color.White, nopsScoreLabel.Font, SubtitleStringFormatCenter ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( nopsScoreTextBox.Text, 170, 40, 55, nopsScoreTextBox.Size.Height, Color.Black, Color.White, nopsScoreTextBox.Font, SubtitleStringFormatCenter ); myPrintDataGrid.SubtitleRow = mySubtitle; myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler( printDoc_PrintPage ); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); } }
private void navPrint_Click( object sender, EventArgs e ) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); //PageSetupDialog bool CenterOnPage = true; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font("Arial Narrow", 14, FontStyle.Bold); Font fontPrintFooter = new Font("Times New Roman", 10); try { curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = true; curPrintDialog.UseEXDialog = true; curPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = true; if ( curPrintDialog.ShowDialog() == DialogResult.OK ) { String printTitle = Properties.Settings.Default.Mdi_Title + "\n Sanction " + mySanctionNum + " held on " + myTourRow["EventDates"].ToString() + "\n" + this.Text; myPrintDoc = new PrintDocument(); myPrintDoc.DocumentName = this.Text; myPrintDoc.DefaultPageSettings.Margins = new Margins( 25, 25, 25, 25 ); myPrintDoc.DefaultPageSettings.Landscape = true; myPrintDataGrid = new DataGridViewPrinter( scoreSummaryDataGridView, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging ); myPrintDataGrid.SubtitleList(); StringRowPrinter mySubtitle; StringFormat SubtitleStringFormat = new StringFormat(); SubtitleStringFormat.Trimming = StringTrimming.Word; SubtitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormat.Alignment = StringAlignment.Center; if ( plcmtDivButton.Checked ) { mySubtitle = new StringRowPrinter( SlalomLabel.Text, 140, 0, 302, SlalomLabel.Size.Height, SlalomLabel.ForeColor, SlalomLabel.BackColor, SlalomLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; } else { mySubtitle = new StringRowPrinter( SlalomLabel.Text, 175, 0, 302, SlalomLabel.Size.Height, SlalomLabel.ForeColor, SlalomLabel.BackColor, SlalomLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; } myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler( printDoc_PrintPage ); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); } } catch ( Exception ex ) { MessageBox.Show( "Exception encountered during print request" + "\n\nException: " + ex.Message ); } }
private void navPrint_Click(object sender, EventArgs e) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); Font saveShowDefaultCellStyle = scoreSummaryDataGridView.DefaultCellStyle.Font; scoreSummaryDataGridView.DefaultCellStyle.Font = new Font("Tahoma", 10, FontStyle.Regular); bool CenterOnPage = true; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font("Arial Narrow", 14, FontStyle.Bold); Font fontPrintFooter = new Font("Times New Roman", 10); curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = false; curPrintDialog.UseEXDialog = true; curPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = true; if (curPrintDialog.ShowDialog() == DialogResult.OK) { String printTitle = Properties.Settings.Default.Mdi_Title + "\n Sanction " + mySanctionNum + " held on " + myTourRow["EventDates"].ToString() + "\n" + this.Text; myPrintDoc = new PrintDocument(); myPrintDoc.DocumentName = this.Text; myPrintDoc.DefaultPageSettings.Margins = new Margins(25, 25, 25, 25); myPrintDoc.DefaultPageSettings.Landscape = true; myPrintDataGrid = new DataGridViewPrinter(scoreSummaryDataGridView, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging); myPrintDataGrid.SubtitleList(); StringRowPrinter mySubtitle; StringFormat SubtitleStringFormat = new StringFormat(); SubtitleStringFormat.Trimming = StringTrimming.Word; SubtitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormat.Alignment = StringAlignment.Center; int curLabelLocSlalom = 0, curLabelLocTrick = 0, curLabelLocJump = 0, curLabelLocOverall = 0; if (myTourRules.ToLower().Equals("ncwsa")) { curLabelLocSlalom = 295; curLabelLocTrick = 572; curLabelLocJump = 737; curLabelLocOverall = 887; } else { if (EventGroup.Visible) { curLabelLocSlalom = 244; curLabelLocTrick = 550; curLabelLocJump = 729; curLabelLocOverall = 897; } else { curLabelLocSlalom = 204; curLabelLocTrick = 517; curLabelLocJump = 697; curLabelLocOverall = 862; } } mySubtitle = new StringRowPrinter(SlalomLabel.Text, curLabelLocSlalom, 0, Convert.ToInt32(SlalomLabel.Width * .8), SlalomLabel.Size.Height, SlalomLabel.ForeColor, SlalomLabel.BackColor, SlalomLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter(TrickLabel.Text, curLabelLocTrick, 0, Convert.ToInt32(TrickLabel.Width * .65), TrickLabel.Size.Height, TrickLabel.ForeColor, TrickLabel.BackColor, TrickLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter(JumpLabel.Text, curLabelLocJump, 0, Convert.ToInt32(JumpLabel.Width * .65), JumpLabel.Size.Height, JumpLabel.ForeColor, JumpLabel.BackColor, JumpLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter(OverallLabel.Text, curLabelLocOverall, 0, OverallLabel.Size.Width, OverallLabel.Size.Height, OverallLabel.ForeColor, OverallLabel.BackColor, OverallLabel.Font, SubtitleStringFormat); myPrintDataGrid.SubtitleRow = mySubtitle; myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); } scoreSummaryDataGridView.DefaultCellStyle.Font = saveShowDefaultCellStyle; }
private void navPrint_Click( object sender, EventArgs e ) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); Font saveShowDefaultCellStyle = scoreSummaryDataGridView.DefaultCellStyle.Font; scoreSummaryDataGridView.DefaultCellStyle.Font = new Font( "Tahoma", 10, FontStyle.Regular ); bool CenterOnPage = true; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font("Arial Narrow", 14, FontStyle.Bold); Font fontPrintFooter = new Font("Times New Roman", 10); curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = false; curPrintDialog.UseEXDialog = true; curPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = true; if ( curPrintDialog.ShowDialog() == DialogResult.OK ) { String printTitle = Properties.Settings.Default.Mdi_Title + "\n Sanction " + mySanctionNum + " held on " + myTourRow["EventDates"].ToString() + "\n" + this.Text; myPrintDoc = new PrintDocument(); myPrintDoc.DocumentName = this.Text; myPrintDoc.DefaultPageSettings.Margins = new Margins( 25, 25, 25, 25 ); myPrintDoc.DefaultPageSettings.Landscape = true; myPrintDataGrid = new DataGridViewPrinter( scoreSummaryDataGridView, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging ); myPrintDataGrid.SubtitleList(); StringRowPrinter mySubtitle; StringFormat SubtitleStringFormat = new StringFormat(); SubtitleStringFormat.Trimming = StringTrimming.Word; SubtitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormat.Alignment = StringAlignment.Center; int curLabelLocSlalom = 0, curLabelLocTrick = 0, curLabelLocJump = 0, curLabelLocOverall = 0; if (myTourRules.ToLower().Equals( "ncwsa" )) { curLabelLocSlalom = 295; curLabelLocTrick = 572; curLabelLocJump = 737; curLabelLocOverall = 887; } else { if (EventGroup.Visible) { curLabelLocSlalom = 244; curLabelLocTrick = 550; curLabelLocJump = 729; curLabelLocOverall = 897; } else { curLabelLocSlalom = 204; curLabelLocTrick = 517; curLabelLocJump = 697; curLabelLocOverall = 862; } } mySubtitle = new StringRowPrinter( SlalomLabel.Text, curLabelLocSlalom, 0, Convert.ToInt32( SlalomLabel.Width * .8 ), SlalomLabel.Size.Height, SlalomLabel.ForeColor, SlalomLabel.BackColor, SlalomLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( TrickLabel.Text, curLabelLocTrick, 0, Convert.ToInt32( TrickLabel.Width * .65 ), TrickLabel.Size.Height, TrickLabel.ForeColor, TrickLabel.BackColor, TrickLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( JumpLabel.Text, curLabelLocJump, 0, Convert.ToInt32( JumpLabel.Width * .65 ), JumpLabel.Size.Height, JumpLabel.ForeColor, JumpLabel.BackColor, JumpLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; mySubtitle = new StringRowPrinter( OverallLabel.Text, curLabelLocOverall, 0, OverallLabel.Size.Width, OverallLabel.Size.Height, OverallLabel.ForeColor, OverallLabel.BackColor, OverallLabel.Font, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = mySubtitle; myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler( printDoc_PrintPage ); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); } scoreSummaryDataGridView.DefaultCellStyle.Font = saveShowDefaultCellStyle; }
private void navPrint_Click(object sender, EventArgs e) { PrintPreviewDialog curPreviewDialog = new PrintPreviewDialog(); PrintDialog curPrintDialog = new PrintDialog(); //Font saveShowDefaultCellStyle = PrintDataGridView.DefaultCellStyle.Font; //PrintDataGridView.DefaultCellStyle.Font = new Font("Tahoma", 12, FontStyle.Regular); bool CenterOnPage = true; bool WithTitle = true; bool WithPaging = true; Font fontPrintTitle = new Font("Arial Narrow", 12, FontStyle.Bold); Font fontPrintFooter = new Font( "Times New Roman", 10 ); curPrintDialog.AllowCurrentPage = true; curPrintDialog.AllowPrintToFile = false; curPrintDialog.AllowSelection = true; curPrintDialog.AllowSomePages = true; curPrintDialog.PrintToFile = false; curPrintDialog.ShowHelp = false; curPrintDialog.ShowNetwork = false; curPrintDialog.UseEXDialog = true; if(curPrintDialog.ShowDialog() == DialogResult.OK) { RankingScore.HeaderText = "NRS"; String printTitle = Properties.Settings.Default.Mdi_Title + "\n Sanction " + mySanctionNum + " held on " + myTourRow["EventDates"].ToString() + "\n" + this.Text; myPrintDoc = new PrintDocument(); myPrintDoc.DocumentName = this.Text; myPrintDoc.DefaultPageSettings.Margins = new Margins( 30, 30, 30, 30 ); myPrintDataGrid = new DataGridViewPrinter( PrintDataGridView, myPrintDoc, CenterOnPage, WithTitle, printTitle, fontPrintTitle, Color.DarkBlue, WithPaging ); if (printHeaderNote.Text.Length > 0) { myPrintDataGrid.SubtitleList(); Font fontPrintSubTitle = new Font( "Arial", 12, FontStyle.Bold ); StringFormat SubtitleStringFormat = new StringFormat(); SubtitleStringFormat.Trimming = StringTrimming.Word; SubtitleStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; SubtitleStringFormat.Alignment = StringAlignment.Center; StringRowPrinter curSubtitle = new StringRowPrinter( printHeaderNote.Text, 0, 0, 750, 25 , Color.DarkBlue, Color.LightGray, fontPrintSubTitle, SubtitleStringFormat ); myPrintDataGrid.SubtitleRow = curSubtitle; } myPrintDoc.PrinterSettings = curPrintDialog.PrinterSettings; myPrintDoc.DefaultPageSettings = curPrintDialog.PrinterSettings.DefaultPageSettings; myPrintDoc.PrintPage += new PrintPageEventHandler( printDoc_PrintPage ); curPreviewDialog.Document = myPrintDoc; curPreviewDialog.ShowDialog(); RankingScore.HeaderText = "Ranking Score"; } }