You can create a custom print preview and customize how your grid will appear when printed. You can do this using the Init method. To override properties like FormBorderStyle, MaximizeBox, MinimizeBox, ControlBox and so on of a Form inherited from C1.Win.C1TrueDBGrid.PrintForm, override the Init method of the PrintForm. First call the base.Init(), then set the properties you want.
Complete the following steps:
C# |
Copy Code
|
---|---|
public partial class PrintForm1 : C1.Win.C1TrueDBGrid.PrintForm |
C# |
Copy Code
|
---|---|
protected override void Init() { base.Init(); FormBorderStyle = FormBorderStyle.Sizable; this.ControlBox = true; this.MinimizeBox = false; this.MaximizeBox = false; } |
C# |
Copy Code
|
---|---|
c1TrueDBGrid1.PrintInfo.PreviewFormClassName = "ProjectName.PrintForm1";
c1TrueDBGrid1.PrintInfo.PrintPreview();
|
Run the application and notice the application appears with a button and grid displaying data. Click the Preview button and observe that a customized print preview form appears. The form only includes the Close button and not the Minimize and Maximize buttons.