Rich Text Box Font Size...
How can I change it if I'm using a ShowFont dialog?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Detecting The Current Font And Font Size On Various Lines In A Rich Text Box.
I have written an editor that uses a rich text box as the main text area.
The editor allows the user to select a font and font size on the toolbar.
My question is, how does one get the combo box text (for both the font and font size) to display the font or font size for the current line of the current character location?
Meaning, if I were to type in two lines, the first line being Arial 12pt, and the second line being Tahoma 14pt, how would I get the program to display the font and font size in the combo boxes?
I know about SelFont, SelStart and such, but I am not selecting any text. I am merely moving the cursor up or down and need to be able to display the font and font size for where the cursor currently is.
Anyone have any ideas?
I thank you in advance.
Detecting Font And Font Size On Various Lines In A Rich Text Box.
I have written a basic editor that uses fonts and such, however when I select a different line (while entering text into the text area of the rich text box), it doesn't display the font or font size for that particular location.
Does anyone have any ideas where I can look to solve this problem?
I thank you in advance for any information you may be able to share with me.
Set Font Size On Rich TextBox
When I set font size of text on a Rich TextBox (txtMainScreen), the actual font size was different form what I want it be. My code looks like this:
Dim tmp As Single
txtMainScreen.Font.Name = "courier new"
tmp = 16
frmMainForm.Font.Size = tmp
txtMainScreen.Font.Size = frmMainForm.Font.Size
'check out for the result
sbrStatus.Panels("Check") = Str(tmp) + Str(frmMainForm.Font.Size) + Str(txtMainScreen.Font.Size)
'then, the result is:
'if tmp=15, then
' Str(tmp)= Str(frmMainForm.Font.Size)=Str(txtMainScreen.Font.Size)=15
Is there anyone help me to solve the problem? Thanks!
My email address is email me
How To Get The Font Name And Font Size Of Header/footer Text?
In one of my procedures, I write the VBA Excel code set the text for headers and footer specifying the font name and font size (code line shown below in part).
'worksheetName has been previously defined to contain the
'name of the worksheet being handled
fullFilename = ActiveWorkbook.FullName
footerText = fullFilename & "[" & worksheetName & "]"
.LeftFooter = "&""Times New Roman,Regular""&06" & footerText
However, when I try to read the same (header/footer text) using code and assign it to a string variable, it actually includes the VBA code referring to the font name and font size as well. This is what I get (the contents of the string variable is shown below).
&"Times New Roman,Regular"&06H:MSOFFICEMY DOCUMENTSCombined National Monthly ReportTest11.xls[SBU - East]
Have a look at all the text prior to "H:..."
But when you see the header/footer content in pagesetup -> headers/footers, you only see the actual text viz :-
"H:MSOFFICEMY DOCUMENTSCombined National Monthly ReportTest11.xls[SBU - East]"
Is there a way to read this actual text only in to a string variable?
Rich Text Boxes (font)
I am trying for the life of me to get my RTB to display Bold font, I would also like to change size as well.
But the code gods are not favoring me today
Dim Fonter As StdFont With Fonter 'I know this looks funny now but one I get this.Bold = True 'working there will be moreEnd WithSet rtbInSum.Font = Fonter TempHold = Format(InExtensionTotalInWrite).TotalCharge, "###,##0.00")rtbInSum.Text = rtbInSum.Text & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & Chr$(32) & _Trim(InExtensionTotal(InWrite).Extension) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & _Chr$(9) & Trim(InExtensionTotal(InWrite).Minutes) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & Chr$(9) & _Chr$(9) & "$" & Trim(TempHold) & Chr$(13) & Chr$(10)
When I run this it displays................nothing!
anyone have any Ideas?
Change Font In A Rich Text Box
I am trying to make a font be applied to an rtb. proplem is, when i use the common dialog, it tells i have no fonts installed. I am currently using this:
On Error Resume Next
If ActiveForm Is Nothing Then Exit Sub
.DialogTitle = "Font"
.CancelError = True
.Flags = cdlPDReturnDC + cdlPDNoPageNums
If ActiveForm.rtfText.SelLength = 0 Then
.Flags = .Flags + cdlPDAllPages
.Flags = .Flags + cdlPDSelection
If Err <> MSComDlg.cdlCancel Then
An help would be appreciated
Change Of Font In Rich Text Box
I wanted to change the font of the selected text in rich text box, but it changes the font for whole rich text box. Can i change the font for selected text as well as can i underline selected text in rich text box.
I am creating a notepad for my computer class project in which i used rich text box as a editable document. Does any one have other solution.
Thanking in anticipation.
Changing Font Properties In Rich Text Box
I am making an application in which the computer will dialog with the user about any problem and the user can answer in "yes" or "no".
I have used rich text box for displaying the conversation. Now i want that whatever questions asked by computer should appear as bold and italic and the answer by user (yes or no) apear in noramal text with a different colour. (like chating software msn or yahoo have different colours for both persons)
How can i change the font proerties at every line. When i used the setfont proerty it change the whole rich text box properties.
Rich Text Box Change Font Color
I have a sub that reads in and changes the selcolor of a rich text box.
The code executes fine and if i run the code and then write in the rich text box the text is the color set by the selcolor but if i click on a button i have set up that simply enters some text into the rich text box the text color stays black (its original color)
what do i need to do to get the text to change to the set color when it is entered like it does when its written in.
Changing Font Color In Rich Text Box
Hi, can u tell me how to change the font color in rich text box control..
I want few
line color to in red
and few in blue
and few in black.
how to get this.
thanks in adv.
How To Change Leading Of A Font For Display In Rich Text
I am trying to reduce the leading in a font that is used in a rich text box.
The richtextbox1.SelCharOffset set to -1, -23 does not do the check when the line wraps. The idea is, given at least 2 lines,:
I would like to get the Line2 characters as close to the Line1 characters (or even overlap them) in a rich text box.
Can anyone offer an example piece of code?
Thanks for the help,
Applying Font Properties Between Two Rich Text Boxes
i am creating a messenger setup. i was told that if i just apply the text from one text box with bold, italic, underline, or strikthru that it would transfer to the next box. but it does not. how do i transfer the bold properties to another text box.
DX7 DD Text Size/font
Is there a way to change the font and/or size of the text for the .DrawText property? If so, how?
Thanks in advance.
Font Size In Text Box
How can I change the text box size, according to the text written within, at runtime. To allow any size of text to fit the size of the text box.
Or is there a way of restricting the font sizes used from the font commondialog box at runtime.
Printer Font Size Vs Picturebox/form/font Size
Sorry for my bad English
Why the printer object font size is different as in Picturebox or form font size property?
I copyied in a PictureBox all the properties availabe in the printer object (width, height, scalemode, scalewidth, etc, etc) to simulate a printer object, but the font size in the picturebox is always greater therefore printer.currentX & Y does not match picture1.currentX & Y
Now, how can I configure a picturebox that matches perfectly the printer proportion? I need it to make Preview routine
How can I caculate the correct scale for Picture1?
Get All Text In A RTB To Be One Font And One Size (using .TextRTF)
I'm looking for a way to make sure all the text in my RTB is one font and one size. I was thinking of removing all "f1", "f2", etc. (1 meaning font #1 from the font table) but the "fs24" (font size) could be any number and I don't really want to do a loop of all possible font sizes from 0 - 99.
I guess I could use InStr to find all "fs" and then remove that and any numbers that follow it. I guess I was looking for an easier way to accomplish this. Like maybe just removing the font from the font table? I guess I would still have the problem with "fs" though...
FONT SIZE In TOOL TIP TEXT
I've got a MSFLEXGRID on a form...
Where does VB get the FONT SIZE for the TOOL TIP TEXT from?
Are there API calls that will allow me to make the FONT of the TOOL TIP bigger than the font of the MSFLEXGRID itself??
Change Output Text's Font Size
i have a problem here.actually im developing a Normalization Tool using Vb 6.0. the main function of this tool is user can draw ERD using drawing toolbar and then this tool will help to narmalized it.for sure,user must input attributes for each entity when drawing ERD.
the entity's name and attribute's name will be appear on the notation of Entity.is it possible if i wan to change the font size of attribute's name?and can give any ideas to do it?
thanks a lots..
Text Size And Font Names In Winspool.drv
following is the code useing in my application, when i direct the file to be prinited in fast way , its printing correct but i cant able print in bold letters and in different fonts, please help
Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Declare Function EndDocPrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Declare Function EndPagePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
Declare Function StartDocPrinter Lib "winspool.drv" Alias "StartDocPrinterA" (ByVal hPrinter As Long, ByVal level As Long, pDocInfo As DOC_INFO_1) As Long
Declare Function StartPagePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Declare Function WritePrinter Lib "winspool.drv" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long) As Long
Public Const CCHDEVICENAME = 32
Public Const CCHFORMNAME = 32
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
pDatatype As String
pDevMode As DEVMODE
DesiredAccess As Long
pDocName As String
pOutputFile As String
pDatatype As String
Public Sub OpenDocForPrint()
Dim strFileText As String
Dim intFile As Integer
Dim strTextToPrint As String
intFile = FreeFile
On Error GoTo Err_Trap
Open "C:p1" For Input As intFile
Do While Not EOF(intFile)
Line Input #intFile, strFileText
strTextToPrint = strTextToPrint & strFileText & vbCrLf
strTextToPrint = strTextToPrint & vbFormFeed
If Err.Number = "75" Then
ElseIf Err.Number = "53" Then
MsgBox "File Not Found", vbOKOnly, "Llamas Rule"
MsgBox Err.Description, vbOKOnly, Err.Number
'Get default printer or use specified printer then spool and print
Public Sub PrintThatFile(strText As String, Optional strPrinter As Variant)
Dim lngPrnHndl As Long
Dim Written As Long
Dim strWrite As String
Dim typDOC As DOC_INFO_1
Dim PrnDef As PRINTER_DEFAULTS
Dim lngCnt As Long
Dim lngFlen As Long
Dim strPrnName As String
Dim strReturn As String
Dim intReturn As Integer
If IsMissing(strPrinter) Then
strReturn = Space(255)
intReturn = GetProfileString("Windows", ByVal "device", "", strReturn, Len(strReturn))
If intReturn Then
strPrnName = UCase(Left(strReturn, InStr(strReturn, ",") - 1))
strPrnName = InputBox("No default Printer Listed, you must provide a Printer name", "Llama Print")
strPrnName = strPrinter
typDOC.pDocName = "Llama Printer"
typDOC.pOutputFile = vbNullString
typDOC.pDatatype = vbNullString
Call OpenPrinter(strPrnName, lngPrnHndl, PrnDef)
Call StartDocPrinter(lngPrnHndl, 1, typDOC)
Call WritePrinter(lngPrnHndl, ByVal strText, Len(strText), Written)
Change Font Size Based On Length Of Text
i want it so that when someone enters something into a text box and push a button the font size of the text is decreased until the whole string is in the textbox and not going outside it.
so say someone enters into a text box "hello my name is blah blah blah"
not all of it will be visible because it goes beyond the length of the text box. i want the program to decrease the size of the text "hello my name is blah blah blah" until it fits into the text box. anyone help me out here ?
Calculating Text Height Based On Font Size
I'm trying to size the height of a rich text box based on how many lines of text will be in the text box. I'm trying to find some way of calculating the expected height of the text as a whole. I was trying to do this by doing a ScaleY(BaseFontSize, vbPoints, vbTwips) * #of lines. This is not working. As I get more lines of text, the box begins to get too small. I already have a functon that determines the #of lines accutately. I am resorting to this method as the richtextbox does not appear to have any type of autosizing. Thanks
Richtextbox Text Changing Color When Font Size Changes
I have code to change the font size of the text in my Richtextbox, but when it does change the font size, it also changes the color of whatever the text currently is to black. In other words, if the text is currently red or blue, it will change the text to black.
combo1.listindex = 0
Private Sub Combo1_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.TextRTF)
RichTextBox1.Font.Size = Combo1.Text
Anyone have any ideas why this might be happening ?
Changing Font Size In Text Mode Printing
I'm printing from my application in text mode. That is by using API functions such as OpenPrinter, StartDocPrinter, WritePrinter etc. My problem is that I need a better way to set the font size. At the moment I'm Doing it by appending chr$(15), chr$(18) etc before the string to be printed.
I just want to know whether there is any other better options to specify the font size.
I'm using VB 6.0 and Windows 98
Changing Textbox Text Font Type/Size, Bold, Italic, Underline And Color
Hi everyone, this is urgent.
I have a textbox where user can type in there. When user select (highlight) the text they can change the font, size, Bold, Italic, Underline and/or color. It should work like in MS Word.
How do I do this? I have a combo box for Fonts, a combo box for Size, and 4 command buttons for B, I, U, and Color.
Retain Font Styles When Changing Font Size
March 25, 2008
Hello, everyone. I searched for over two hours for an answer but didn't find a relevant forum example. I am using a richtextbox for my documentation. I made several simple font features such as font sizes and font styles (bold and underline) to the richtextbox. The problem I have is that after I bolded and underlined some of my document text, if I change my document to a different font size, any text that have been bolded or underlined will be undone, so I have to highlight them and bold or underline them again. Does anyone have any advice or any example code to correct it?
The following is a fragment of code in selecting for fontbold and for changing font size:
If Len(Trim(RichTextBox1.SelText)) > 0 Then' For selecting text
RichTextBox1.SelFontSize = 14
RichTextBox1.SelBold = Not (RichTextBox1.SelBold)' For selecting text for bold
RichTextBox1.Font.Size = 14 ' Font size to the whole document or richtextbox
Any advice or help will be greatly appreciated.
How To Change The Font Type And Font Size For A Menu Bar?
I meet a problem in my application. How can i change the font type and font size for the menu used in th form? Since my application is run on 1280x1024, it is too small to see the type on the menu bar. Could anyone help me? Very urgent!!! Thanks.
Changing Font Size And Bold And Font ???
dim Heading as string
Heading = "I want to Make this sentance Bold and bigger"
how would i go about making this variable bold and changing the font and font size.
Font Type && Font Size
I was wondering what font type and font size you usually use in your vb projects.
What font size is too small, and what size is too big?
Do you use different fonts in your project? or maybe different font sizes?
As you noticed my question is some kind of a poll, I hope there will be much replies.
Thank you for your time!
Web Font Question: Font Size
has anyone by chance tried to figure out a way to convert font point size to html size?
Like FontSize @ 8 = HTML font size 1???
(I have figured out how to change web page settings on the fly...BG color...text color...link color...ONLY for less complex pages)
Font Size Vs Font Selected?
I'm creating the editing toolbar for a Rich Text Box, and am starting work on the Font selector (combo) & Font Size selector (combo) and was wondering: Is the size dependant on the font chosen or can the font be any size the user chooses?
+--VB Dot Net
+-- Navman GPS Forums @ http://forum.jdmils.com
Textbox Size/font Size
Does anyone know how to resize a textbox (at runtime), so that if you change the font size for it, it'll adjust to fit the font?
Rich TextBox Font ???
Can anyone help me, I don't know how to use a rich text box. I only want to display text in different fonts, but I have no clue how???
Rich Textbox Font Color
I made a chat window for my chat program that when it loads up, it's
rich textbox color alway reverts back to black.
What the chat form does is when you click on the send button, the
message is sent and then the form is unloaded. I have public variables
in place to hold all the font properties. When the user sends a message
back, the chat form or message box loads back up, displaying the new
message. In the form load event, the font properties are reloaded with
the values already held in the public font variables and everything works
except for the font color.
My problem is that even if i have my font color set to red, when the form
loads back up, the rich textbox font color always goes back to black.
I've heard and experienced myself that the rich textbox has flaws in it.
For instance, if the font color is set to red and i change the font bold
property, the font color goes back to black.
I was just wondering if there is a way to subclass the rich textbox to
get it's font color property instead of the Selcolor property.
I noticed the rich textbox has font.bold, font.italic, font.underline and
font.size properties but not font.color. I wonder why?
Rich TextBox (Khmer Font)
I use Rich TextBox in Vb6 to view khmer font (Limon S2) it can see but it seem to be loose so how can i make it near each other.
Thank in adcance.
My emial : email@example.com;firstname.lastname@example.org
Changing The Font Color Of A Rich Textbox
how can I change the font color of a rich textbox? I've tried looking for "forecolor" option but there's none...
Edited by - gen23 on 5/6/2004 10:44:28 PM
How To Save Text Fontsize, Font Style And Font Color
When I save the text in a Richtextbox to a Access Database, How to save the font style and Font color with the text (Assume that user can change font style and color when they typing text into the richtextbox).
Then when I load the text from Access Database back to the Richtextbox, it should associate with it's font style and color when I was saved.
How to realize these functions???
Thanks in advance