-

2011年8月3日星期三

Visual Basic FontDialog?

-I am creating a Notepad in Visual 2010 Ultimate but I cant get the FontDialog to work. I tried:

Button coding: Fontdialog1.show

Textbox1.Text = Fontdialog1.Font

But I had an error. Anyone know how to work this?This is how to do what I think you're after:



FontDialog1.ShowDialog()

TextBox1.Text = FontDialog1.Font.Name.ToString



It'll send the name of the font chosen to the box.



Took me a bit of tinkering to find.





And some full working code for a font dialog that I jsut did if you want it:



FontDialog1.ShowColor = True





FontDialog1.ShowDialog()



TextBox1.ForeColor = FontDialog1.Color

TextBox1.Font = FontDialog1.Font

TextBox1.Text = FontDialog1.Font.Name.ToString



Keep in mind that this could will run even if you exit from changing fonts, you'll have to fix that if you implement it.How the hell did you get Visual Studio 2010 Ultimate?

Anyway, you can't convert from font to text, but you can use that font as the font of the text box, or display some of the fonts properties.

没有评论:

发表评论