This is a migrated thread and some comments may be shown as answers.

CaptionText and ContentText font style.

5 Answers 304 Views
DesktopAlert
This is a migrated thread and some comments may be shown as answers.
wiquezada
Top achievements
Rank 1
wiquezada asked on 08 Nov 2017, 02:45 PM

Hello,

Hello,
Is there a way to set font style; size, font family (with html option or another way) of Caption Text and ContentText?

Kind regards...

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Nov 2017, 11:55 AM
Hello, William,

Thank you for writing.  

In order to customize a specific element in RadDesktopAlert, it would be useful to get familiar with the internal element structure: https://docs.telerik.com/devtools/winforms/desktopalert/structure

You can specify the font to be used for RadDesktopAlert by using the following code snippet: 
this.radDesktopAlert1.CaptionText = "New E-mail Notification";
this.radDesktopAlert1.ContentText = "Hello Jack, I am writing to inform you " +
                                    "that the planning meeting scheduled for Wednesday has been postponed and" +
                                    "it will eventually be rescheduled, possibly for the next Tuesday";
 
this.radDesktopAlert1.Popup.AlertElement.ContentElement.Font = new Font("Arial", 8f, FontStyle.Italic);
this.radDesktopAlert1.Popup.AlertElement.CaptionElement.TextAndButtonsElement.TextElement.Font = new Font("Verdana", 14f, FontStyle.Italic);
this.radDesktopAlert1.Show();



I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
wiquezada
Top achievements
Rank 1
answered on 09 Nov 2017, 02:04 PM

Dess,

Thank you very much, the information was very helpful for me.

One more question, is there any way to add padding to the Content Image?

 

Kind Regards,

William

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Nov 2017, 09:28 AM
Hello, William,    

Thank you for writing back. 

RadDesktopAlertElement is a derivative of LightVisualElement which displays the text and image. You can create a DockLayoutPanel and place two LightVisualElements, one for the image part and one for the text part. Thus, you can specify the desired Margin between the text and image parts. Here is a sample code snippet: 
this.radDesktopAlert1.CaptionText = "New E-mail Notification";
DockLayoutPanel dockPanel = new DockLayoutPanel();
dockPanel.LastChildFill = true;
dockPanel.StretchHorizontally = true;
 
LightVisualElement imageElement = new LightVisualElement();
imageElement.Image = Properties.Resources.send_email;
imageElement.ImageLayout = ImageLayout.Zoom;
 
LightVisualElement textElement = new LightVisualElement();
textElement.Text = "<html><i><color= Red>You have 16 new email messages.";
textElement.StretchHorizontally = true;
textElement.TextAlignment = ContentAlignment.MiddleLeft;
textElement.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0);
 
dockPanel.Children.Add(imageElement);
dockPanel.Children.Add(textElement);
 
this.radDesktopAlert1.Popup.AlertElement.ContentElement.Children.Add(dockPanel);
this.radDesktopAlert1.Popup.AlertElement.ContentElement.TextAlignment = ContentAlignment.MiddleLeft;
this.radDesktopAlert1.Popup.AlertElement.ContentElement.ImageAlignment = ContentAlignment.MiddleLeft;
this.radDesktopAlert1.Show();

I hope this information helps. If you have any additional questions, please let me know. 

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Kun
Top achievements
Rank 2
answered on 15 Feb 2019, 09:24 AM

Hello Dess,

Your method works great for me.

And then I put the definition of dockpanel in the myform.designer.vb (because I can't do the same thing in design view), it also works.

But since I modified something design in myform, the dockpanel part will be deleted automatically in myform.designer.vb.

Is there a conflict somewhere between dockpanel and form design ?

 

Thank you by advance.

0
Dimitar
Telerik team
answered on 18 Feb 2019, 02:08 PM
Hi William,

The code in is regenerated each time you open the designer or Visual Studio. Instead, you can add it in the form constructor or use the forms Load event. 

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.
Tags
DesktopAlert
Asked by
wiquezada
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
wiquezada
Top achievements
Rank 1
Kun
Top achievements
Rank 2
Dimitar
Telerik team
Share this question
or