We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Printing settings for Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

6108 Jul 31,2003 02:56 AM Aug 13,2003 02:06 AM Windows Forms 8
loading
Tags: GridControl
Nick Pasko
Asked On July 31, 2003 02:56 AM

I want to print the grid with no gridlines, with a preset background and text color. setting : this.gridControl1.BackColor = Color.White; this.gridControl1.ForeColor = Color.Black; this.gridControl1.Properties.DisplayHorzLines = false; this.gridControl1.Properties.DisplayVertLines = false; does not make a difference - it sets only the BackColor. ForeColor does not work at all, and gridlines are not displayed in Grid itself, but are shown in Print Preview (and are also visible on the printed document). How can I make this work? :-\

Administrator [Syncfusion]
Replied On July 31, 2003 05:04 AM

Below is code that I think will display black and white like your sample code. If you want different textcolor and background than B&W, then you will have to set grid.BaseStylesMap["Standard"].StyleInfo.TextColor (and BackColor). grid.BeginUpdate(); grid.Properties.BlackWhite = true; grid.Properties.DisplayHorzLines = false; grid.Properties.DisplayVertLines = false; GridBorderStyle border = grid.DefaultGridBorderStyle; grid.DefaultGridBorderStyle = GridBorderStyle.None; GridPrintDocument pd = new GridPrintDocument(gridControl1, true); PrintPreviewDialog dlg = new PrintPreviewDialog() ; dlg.Document = pd; ((Form)dlg).WindowState = FormWindowState.Maximized; dlg.ShowDialog(); grid.Properties.BlackWhite = false; grid.Properties.DisplayHorzLines = true; grid.Properties.DisplayVertLines = true; grid.DefaultGridBorderStyle = border; grid.EndUpdate();

Nick Pasko
Replied On August 6, 2003 02:14 AM

The problem is - with grid.Properties.BlackWhite set true grid does not show any colors but black and white (and, as i could see, it shows the text in black even if the text color is white). And I need to fill some cells with colors (and I don't care they will be printed uncolored, i want them to be seen and differ from black AND white. My current prob is if BlackWhite is set to false - grid somehow displays a system default text color, which is set to green on my PC. So, after printing it is really troublesome to read the text. Is there any way to set the TextColor (or ForeColor, i don't care) for the entire grid, not every single cell?

Administrator [Syncfusion]
Replied On August 6, 2003 02:17 AM

You can set the default TextColor for a grid by setting it in the standard style. this.grid.BaseStylesMap["Standard"].StyleInfo.TextColor = Color.Red;

Nick Pasko
Replied On August 6, 2003 04:20 AM

Thanks! :) One additional question - how do I remove a border which is still printed?

Administrator [Syncfusion]
Replied On August 6, 2003 05:18 AM

If a border is still being displayed after the previous code, then this border must be explicitly set in some style object. In this case, you would have to call style.Borders.ResetAll() to make the borders used the default border style which you set to None. Or, the border is being drawn because of something else. For example,if it is a rowheader, then the default behavior is to draw these 3d which gives the solid line on the right and bottom of the cell which looks like a gridline. In this case, you some how have to prevent the drawing, maybe: this.gridControl1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Static"; which makes the row headers static cells instead of header cells.

Nick Pasko
Replied On August 6, 2003 08:37 PM

Ouch, there seems to be a misunderstanding, probably due to my bad English.. I meant the GRID border, outlining the whole GRID, not the CELL border.

Administrator [Syncfusion]
Replied On August 7, 2003 01:50 AM

There is a property setting that controls whether that frame is printed. grid.Properties.PrintFrame = false;

Nick Pasko
Replied On August 13, 2003 02:06 AM

Thanks again!

CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;