アプリケーション内のすべてのRadMessageBoxのフォントをカスタマイズすることができます。
- 任意のフォームおよび/またはRadMessageBoxが作成される前に呼び出されるメソッド( 'SetTelerikControlStyles')を実装します。あなたは一度このメソッドを呼び出す必要があります!名前がすでに明らかになったとして、RadMessageBoxのタイトルバーで、
RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Calibri", 25f);
RadMessageBox.Instance.Controls["radLabel1"].Font = new Font("Calibri", 50f, FontStyle.Regular);
FormElement.TitleBar.Font:
ステップ1の作成方法には次のコード行を追加します。 。
Telerikは動的名前付きコントロールを使用しています。この場合、radLabel1はRadMessageBoxテキストエリアを表します。
完全Program.csのサンプル:
using System;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls;
namespace WindowsFormsApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SetTelerikControlStyles();
Application.Run(new Form1());
}
private static void SetTelerikControlStyles()
{
RadMessageBox.Instance.FormElement.TitleBar.Font = new Font("Calibri", 25f);
// I added this additional check for safety, if Telerik modifies the name of the control.
if (RadMessageBox.Instance.Controls.ContainsKey("radLabel1"))
{
RadMessageBox.Instance.Controls["radLabel1"].Font = new Font("Calibri", 50f, FontStyle.Regular);
}
}
}
}
は、なぜあなたはカスタムコントロールを作成しませんか?おそらく[FlexibleMessageBox](https://www.codeproject.com/Articles/601900/FlexibleMessageBox-A-flexible-replacement-for-the)を使うことができます。 – Odrai
Odraiに感謝します。フォントサイズを増やしたいだけなので、私はもっと簡単なアプローチを探していました。最終的に、私はそれをしなければならないかもしれません。 – dpdragnev
以下のメッセージに回答を掲載しました。ご不明な点がございましたら、お気軽にお問い合わせください。 – Odrai