|
-
Nov 22nd, 2008, 02:43 AM
#1
Thread Starter
New Member
[RESOLVED] [2008] Font problem in my notepad program
I have a small problem with a notepad look-alike program... It's no problem to save the file, it creates it and all, but if I save the text file with a font, (maybe times new roman, size 72 and color blue), when I open the file, the text is blue and the font i microsoft sans serif, size 9.
What's wrong with it? Is it the code?
So, i tested my code in another notepad that i made really fast using a richtextbox and a regular textbox and it has the same problem!
-
Nov 22nd, 2008, 03:24 AM
#2
Re: [2008] Font problem in my notepad program
You can't save a text file with a font. Text files contain plain text only, i.e. each byte represents a character and that's it. In order to store formatting information, like fonts, you would have to save to a file format that supports text formatting, e.g. RTF.
The standard TextBox supports plain text only. It will allow you to change the colour, font, etc. of the display but that is NOT part of the data itself. If you save the contents of a TextBox then it's just the characters you're saving. That's how Notepad works too.
The RichTextBox control supports the RTF format. RTF is similar to HTML in that the data contains tags that describe how the text should be displayed. Wjem you save the contents of a RichTextBox you're saving that formatting information too. That's how WordPad works too.
-
Nov 22nd, 2008, 03:44 AM
#3
Thread Starter
New Member
Re: [RESOLVED] [2008] Font problem in my notepad program
Thanks a lot! That solved my problem!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|