Hi,
I'm trying to being able to show or a hide an icon on a button when a PDF has been loaded. How do I show/hide an imported image resource for the project. Attached is a screenshot of the button when I set the image at design time but I need a way to show/hide this in code. Thanks!
J
4 Answers, 1 is accepted
0
Hello, Jeffrey,
The RadButton.DisplayStyle property gives you the opportunity to control whether the image will be shown or not. If you need to show text and image, you set the DisplayStyle property to ImageAndText. Otherwise, set it to Text:
I hope this information helps.
Regards,
Dess
Progress Telerik
The RadButton.DisplayStyle property gives you the opportunity to control whether the image will be shown or not. If you need to show text and image, you set the DisplayStyle property to ImageAndText. Otherwise, set it to Text:
public
RadForm1()
{
InitializeComponent();
this
.radButton1.Image = Properties.Resources.buttonDelete;
this
.radButton1.TextImageRelation = TextImageRelation.TextBeforeImage;
}
private
void
radButton1_Click(
object
sender, EventArgs e)
{
if
(
this
.radButton1.DisplayStyle == Telerik.WinControls.DisplayStyle.ImageAndText)
{
this
.radButton1.DisplayStyle = Telerik.WinControls.DisplayStyle.Text;
}
else
{
this
.radButton1.DisplayStyle = Telerik.WinControls.DisplayStyle.ImageAndText;
}
}
I hope this information helps.
Regards,
Dess
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jeffrey
Top achievements
Rank 1
answered on 28 Sep 2018, 11:18 PM
Hi, I had to modify the code to this:
Me
.btnUserCredentialsAttachPDF.Image = My.Resources.Pdf
Me
.btnUserCredentialsAttachPDF.TextImageRelation = TextImageRelation.TextBeforeImage
My issue is that this shows the image only if I set it at design time. If I use:
Me
.btnUserCredentialsAttachPDF.DisplayStyle = Telerik.WinControls.DisplayStyle.ImageAndText
In the code when I want to show the text and image after a user attached a PDF it does nothing and the button just has text.
0
Accepted
Hello Jeffrey,
I have tested this and it works on my side. For convenience, I prepared a small sample, based on the information that you provided so far and attached it to this thread. Could you please check it and let me know how it differs from your real setup?
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
I have tested this and it works on my side. For convenience, I prepared a small sample, based on the information that you provided so far and attached it to this thread. Could you please check it and let me know how it differs from your real setup?
I am looking forward to your reply.
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.
0
Jeffrey
Top achievements
Rank 1
answered on 01 Oct 2018, 08:21 PM
Hi,
Yes I was able to use your sample to make it work. Thanks!