Can you please tell me how to enable the StiPreviewControl to close if I press the escape key (ESC).
I also would like to know how the config.CloseEnabled works (example
I do
#region ToolBar
//Do this operation once when running the program
StiConfig.Load();
//Get service
StiPreviewConfigService config =
StiConfig.Services.GetService(typeof (StiPreviewConfigService)) as StiPreviewConfigService;
//Turn off all buttons of changes of the rendered report
// config.PageNewEnabled = false;
if (config != null) {
config.CloseEnabled = true;
config.ToolEditorActive = false;
config.ToolEditorEnabled = false;
config.PageDesignEnabled = false;
config.PageDeleteEnabled = false;
config.PageNewEnabled = false;
config.PageSizeEnabled = false;
config.OpenEnabled = false;
config.SaveEnabled = true;
}
//Save configuration if necessary
StiConfig.Save();
#endregion
The close button appears but when I click nothing happens
Thanks in advance.
How to close a StiPreviewControl using ESC Key?
How to close a StiPreviewControl using ESC Key?
Hello,
Thank you.
Please set KeyPreview property of form which contain StiPreviewControl to true. After then use following code for KeyDown event of form:Can you please tell me how to enable the StiPreviewControl to close if I press the escape key (ESC).
Code: Select all
private void StiViewerForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)Close();
}
You need use Close event of StiPreviewControl. Please see example:I also would like to know how the config.CloseEnabled works (example
Code: Select all
private void ViewerControl_Close(object sender, System.EventArgs e)
{
Close();
}
Thank you.
How to close a StiPreviewControl using ESC Key?
Thanks for the info!