Change the ICon of tool
Change the ICon of tool
How should i change the icon of export to save icon from tool bar?
Change the ICon of tool
If you want to change behavior of export button, please, see this topic:
http://www.forum.stimulsoft.com/Default ... osts&t=547
http://www.forum.stimulsoft.com/Default ... osts&t=547
Change the ICon of tool
You can access to toolbar via property Toolbar of StiPreviewControl. Control with index 3 is export button.
Thank you.
Thank you.
Change the ICon of tool
That is readonly property but how should i change the 'ICON' of export button from toolbar in preview window?
Can you provide me code to do this?
Can you provide me code to do this?
Change the ICon of tool
Please use the following code:
The code above you should use when you are using StiPreviewControl on your form for the previewing of the report.
But if you do not using the StiPreviewControl component then you should modify method of calling the report in the following way:
Instead of calling report.Show() (or Show(true)) you should call the method CustomPreview
Thank you.
Code: Select all
С#:
StiPreviewControl stiPreview = new StiPreviewControl();
StiToolBar tb = stiPreview.ToolBar;
StiToolButton btnSave = (tb.Controls["tbSave"] as StiToolButton);
StiToolButton btnExport = (tb.Controls["tbExport"] as StiToolButton);
btnExport.Image = btnSave.Image;
Code: Select all
VB:
Dim stiPreview As New StiPreviewControl
Dim tb As StiToolBar = stiPreview.ToolBar
Dim btnSave As StiToolButton = TryCast(tb.Controls.get_Item("tbSave"),StiToolButton)
Dim btnExport As StiToolButton = TryCast(tb.Controls.get_Item("tbExport"),StiToolButton)
btnExport.Image = btnSave.Image
But if you do not using the StiPreviewControl component then you should modify method of calling the report in the following way:
Instead of calling report.Show() (or Show(true)) you should call the method CustomPreview
Code: Select all
C#:
private void CustomPreview()
{
StiReport report = new StiReport();
...
using (StiPreviewForm form = new StiPreviewForm(report))
{
StiPreviewControl stiPreview = form.PreviewControl;
stiPreview.Close += new EventHandler(stiPreview_Close);
StiToolBar tb = stiPreview.ToolBar;
StiToolButton btnSave = (tb.Controls["tbSave"] as StiToolButton);
StiToolButton btnExport = (tb.Controls["tbExport"] as StiToolButton);
btnSave.Image = btnExport.Image;
report.Render();
form.ShowDialog();
stiPreview.Close -= new EventHandler(stiPreview_Close);
}
}
public void stiPreview_Close(object sender, EventArgs e)
{
((sender as StiPreviewControl).Parent as StiPreviewForm).Close();
}
Code: Select all
VB:
Private Sub CustomPreview()
Dim report As New StiReport
...
Using form As StiPreviewForm = New StiPreviewForm(report)
Dim stiPreview As StiPreviewControl = form.PreviewControl
AddHandler stiPreview.Close, New EventHandler(AddressOf Me.stiPreview_Close)
Dim tb As StiToolBar = stiPreview.ToolBar
Dim btnSave As StiToolButton = TryCast(tb.Controls.get_Item("tbSave"),StiToolButton)
Dim btnExport As StiToolButton = TryCast(tb.Controls.get_Item("tbExport"),StiToolButton)
btnSave.Image = btnExport.Image
report.Render
form.ShowDialog
RemoveHandler stiPreview.Close, New EventHandler(AddressOf Me.stiPreview_Close)
End Using
End Sub
Public Sub stiPreview_Close(ByVal sender As Object, ByVal e As EventArgs)
TryCast(TryCast(sender,StiPreviewControl).Parent,Form).Close
End Sub
Change the ICon of tool
Thank You it works...
Change the ICon of tool
Let us know if you need any help.
Thank you.
Thank you.