Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
21874 | Nov 25,2004 08:25 AM UTC | Nov 27,2004 02:06 AM UTC | WinForms | 7 |
![]() |
Tags: GridControl |
private void button2_Click(object sender, System.EventArgs e) { //selected if (this.gridDataBoundGrid1 != null) { if(this.gridDataBoundGrid1.Selections.Count == 0) { MessageBox.Show("Select some cells first."); return; } GridRangeInfoList rangeList = new GridRangeInfoList(); foreach(GridRangeInfo range in this.gridDataBoundGrid1.Selections) { if(!range.IsCells) rangeList.Add(range.ExpandRange(1, 0, this.gridDataBoundGrid1.Model.RowCount, this.gridDataBoundGrid1.Model.ColCount) ); else rangeList.Add((GridRangeInfo)range.Clone()); } this.gridDataBoundGrid1.Selections.Clear(false); foreach(GridRangeInfo range in rangeList) this.gridDataBoundGrid1.Selections.Add(range); GridPrintDocument pd = new GridPrintDocument(this.gridDataBoundGrid1, true); pd.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection; PrintPreviewDialog dlg = new PrintPreviewDialog() ; dlg.Document = pd; dlg.ShowDialog(); } } private void button3_Click(object sender, System.EventArgs e) { if (this.gridDataBoundGrid1 != null) { GridPrintDocument pd = new GridPrintDocument(this.gridDataBoundGrid1); PrintDialog dlg = new PrintDialog() ; dlg.Document = pd; dlg.AllowSomePages = true; if(dlg.ShowDialog() == DialogResult.OK) { pd.Print(); } } }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.