[2005] Help with imposting the size of the letters
Hi,I'm new to this forum:wave:
I would like to do a program style word pad.
The open/save and new file dialog works perfectly but now how can I do that when I click on button the size of the letters to write will be 20?If you can please write here the code.I know my English is bad but I'm trying to talk:D
Thanks in advance.
Re: [2005] Help with imposting the size of the letters
Add a numeric up down control to your form, and fill in the values for the size of the text you want them to be able to use. Detect when the value of the numeric updown changes and change the text size of your rich text box accordingly.
D
Re: [2005] Help with imposting the size of the letters
Sorry but I didn't undertand.:confused: :confused:
I have a textbox not a richtextbox.
Is possible to do this in a textbox?
If yes can you write here the code?
Sorry and thanks in advance:D
Re: [2005] Help with imposting the size of the letters
yes it is possible, simply set the textbox's Font property to a new Font that's a larger size
Look into the TextBox class and the Font class at MSDN
http://msdn2.microsoft.com/en-us/lib...trol.font.aspx
http://msdn2.microsoft.com/en-us/lib...wing.font.aspx
so you would want to do something like:
TextBox1.Font = New Font("Microsoft Sans Serif", 12, FontStyle.Regular)
or
TextBox1.Font = New Font("Microsoft Sans Serif", 14, FontStyle.Regular)
Re: [2005] Help with imposting the size of the letters
vb.net Code:
Dim fontSize as Integer = 12
public sub buttonUP() handles button1.click
fontSize += 1
textbox1.Font = New Font("Microsoft Sans Serif", fontSize, FontStyle.Regular)
end sub
public sub buttonDown() handles button2.click
fontSize -= 1
textbox1.Font = New Font("Microsoft Sans Serif", fontSize, FontStyle.Regular)
end sub
to change the size up and down using buttons
*dont copy as is
you can just do on a button click
vb.net Code:
textbox1.Font = New Font("Microsoft Sans Serif", 20, FontStyle.Regular)
Re: [2005] Help with imposting the size of the letters
If you're imitating WordPad then presumably you are using a RichTextBox and you want to format only part of the text. In that case it would look like this:
vb.net Code:
myRichTextBox.SelectionFont = New Font(myRichTextBox.SelectionFont.FontFamily, newSizeHere, my.RichTextBox.SelectionFont.Style)
Note that things get complex when you have already formatted two sections differently, then you select part of each section and try to format them as one block. You can lose some formatting on one or both blocks depending on the circumstances.