Hi Mihajlo,
This can be achieved by manually showing the print preview dialog. This way you can access the controls and hide the settings button. In addition, you should create a custom RadPrintPreviewDialog to intercept the print button and print without showing the settings. Here is a complete example of this:
public
partial
class
RadForm1 : Telerik.WinControls.UI.RadForm
{
public
RadForm1()
{
InitializeComponent();
radRichTextEditor1.CommandExecuting += RadRichTextEditor1_CommandExecuting;
}
private
void
RadRichTextEditor1_CommandExecuting(
object
sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutingEventAr
{
if
(e.Command
is
PrintCommand)
{
e.Cancel =
true
;
radRichTextEditor1.Print(
false
);
}
else
if
(e.Command
is
PrintPreviewCommand)
{
e.Cancel =
true
;
var document =
new
RadPrintDocument();
document.AssociatedObject = radRichTextEditor1.RichTextBoxElement;
MyRadPrintPreviewDialog dialog =
new
MyRadPrintPreviewDialog(document);
var commandaBar = dialog.Controls[1]
as
RadCommandBar;
commandaBar.Rows[0].Strips[0].Items[1].Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
dialog.ShowDialog();
}
}
}
class
MyRadPrintPreviewDialog : RadPrintPreviewDialog
{
public
MyRadPrintPreviewDialog(RadPrintDocument doc) :
base
(doc)
{
}
protected
override
void
OnShowPrintDialog()
{
//base.OnShowPrintDialog();
this
.Document.CurrentPage =
this
.printPreviewControl.StartPage + 1;
this
.Document.SelectionLength =
this
.printPreviewControl.Rows *
this
.printPreviewControl.Columns;
this
.Document.Print();
}
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Get
quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.
Learn More.