Text Size
How would you set the size of the text?
becuase I have this:
RtextboxUC thisrichtextbox = GetCurrentTextBox();thisrichtextbox.TextBox.Font.SizeInPoints =
newFont(thisrichtextbox.Font, TextSizeCombo.SelectedItem);but I get 2 erros with the thisrichtextbox.TextBox.Font.SizeInPoints =newFont(thisrichtextbox.Font, TextSizeCombo.SelectedItem);
1:The best overloaded method match for 'System.Drawing.Font.Font(System.Drawing.Font, System.Drawing.FontStyle)' has some invalid arguments2:cannot convert from 'object' to 'System.Drawing.FontStyle'
Thanks :)
Hi,
From the error message 2, its saying that you are passing invalid argument for System.Drawing.FontStyle. Did you try passing the fontstyle, something like this...?new System.Drawing.Font("Tahoma",System.Drawing.FontStyle.Regular)
Thank you,
Bhanu.
Like this:
thisrichtextbox.TextBox.Font.SizeInPoints =
new Font(thisrichtextbox.Font, Convert.ToSingle(toolStripComboBox1.SelectedItem), FontStyle.Regular);?
If so then I got 2 errors:
Error 1 The best overloaded method match for 'System.Drawing.Font.Font(System.Drawing.FontFamily, float, System.Drawing.FontStyle)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'System.Drawing.Font' to 'System.Drawing.FontFamily'
If not...then could you explain again?
Thanks :)
Ok, I found abetter way, here is what I did:
System.Drawing.
Font thecurrentFont = thisrichtextbox.TextBox.SelectionFont;thisrichtextbox.TextBox.SelectionFont =
new Font(thecurrentFont.FontFamily, comboBox1.SelectedIndex, thecurrentFont.Style);But now what happens is there are 0 errors BUT if Ic hange the size int eh combobox to 18 then the size becomes even lower then 8... If I put it on 8 then I get a runtime error aboutt he size being smaller then I can be.... Is there somthing that I should change in the code or in the combobox items?
Thanks for your help :)
Ok, I got no errors with it, so when I tested it I set it to 50 and......the size stayed 8 but the combobox item text size became 50....
Actualy I jsut looked over it and found the problem, You were setting it to change the combobox size....
So I changed it to set the richtextbox font size, so now it works just fine other then the point it changes ALL the text to that size...How would I amke it just do the selected text?
Thanks :)