Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to increase the font size and font name of the message box.
As it will be having default System font size and font name, How do i can change it to my wish. I am using VB.net 2008
Posted

I resolved my problem, by creating a new form and placing a label, button. Now it behave as message box.
Also i have changed the font size and color of the label as per requirement. Below is the code written in VB.net 2005

C#
private void Form1_Load(object sender, EventArgs e)
       {
           this .MaximizeBox = false ;
           this.MinimizeBox = false;

           msgbox("Hello world.", "Message Box", true, true);

           this.label1.Left = this.Width - 800;
           this.button1.Left = this.Width - 500;
           this.button2.Left = this.Width - 400;
       }


C#
public void msgbox(string msg, string title, bool ok, bool cancel)
       {
           this.label1.Text = msg;
           this.Text = title;
           this.button1.Visible = ok;
           this.button2.Visible = cancel;
           SetHeightWidth(ok,cancel);
       }
 
Share this answer
 
The MessageBox uses the currently selected system font. The only way you're going to be able to change it is to create your own MessageBox object. I found this on google (you know - that free search engine)...

http://www.news2news.com/vfp/?solution=5[^]
 
Share this answer
 
Comments
Asif Iqbal A.Khan 2-Jul-11 2:16am    
ya i got it, thanks for ur rep
Make a form with buttons as required, and a label with whatever font for message.
Set properties on form, make OK AcceptButton and Cancel CancelButton

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.cancelbutton.aspx[^]
 
Share this answer
 
Comments
Asif Iqbal A.Khan 2-Jul-11 2:17am    
Thanks for ur rep, i got the solution
The best way I think is to create your own custom MessageBox for that purpose.
Check out this discussion:
http://stackoverflow.com/questions/232066/messagebox-show-font-change[^]

And a CP article:
http://www.codeproject.com/KB/dialog/MessageBoxEx.aspx[^]

Hope it helped.
Good luck. :thumbsup:
 
Share this answer
 
Comments
Asif Iqbal A.Khan 2-Jul-11 2:17am    
Thanks for ur rep, i got the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900