如何使用Vb.net在“消息"框中增加字体大小和字体名称 [英] How to increase the font size and font name in Message box, using Vb.net

查看:711
本文介绍了如何使用Vb.net在“消息"框中增加字体大小和字体名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想增加消息框的字体大小和字体名称.
由于它将具有默认的系统字体大小和字体名称,因此我该如何更改它.我正在使用VB.net 2008

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

推荐答案

我通过创建新表单并放置标签,按钮来解决了我的问题.现在它就像消息框一样.
我也根据要求更改了标签的字体大小和颜色.下面是用VB.net 2005编写的代码

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

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;
       }





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);
       }


MessageBox使用当前选定的系统字体.您要更改它的唯一方法是创建自己的MessageBox对象.我在Google上找到了这个(您知道-免费的搜索引擎)...

http://www.news2news.com/vfp/?solution=5 [
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[^]


使用按钮创建表单根据需要,以及带有任何消息字体的标签.
在表单上设置属性,单击确定",然后单击接受",然后取消取消"按钮

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.cancelbutton.aspx [ ^ ]
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[^]


这篇关于如何使用Vb.net在“消息"框中增加字体大小和字体名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆