Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Rich text News


mitlark
 Share

Recommended Posts

Well, I wanted to make some contribution to the community, so I thought about this. It's a very simple and not useful modification to the vanilla news. So here it goes.
And everything is client-sided, so feel free of worries, your game will work even if you fail (that's petty impossible with this stuff).

So, let's start.

CLIENT-SIDE

*-First, you can either delete, hide, eat, whatever, the lblNews. You will not need it, or if you want you can use it as a title or something (but you can also insert that title in the rich textbox).

1-Make a RichTextBox object, place it inside of the picMain picturebox. Make it the size you want, the reason of this is to get it larger, but if all you want is format, feel free to do it normal size.

2-Now, name the richtextbox… mmm let's say _'txtNews'_ (without quotes). You can also set a background color, and if you don't like it, remove the borders. For that stuff revise and adjust properly the Appearance, BackColor and BorderStyle properties.

3-There's the textbox, now to the code! We will now change a little things there.
Search in the frmMenu the following:
```
' load news
    Open App.Path & "\data files\news.txt" For Input As #1
        Line Input #1, tmpTxt
    Close #1
    ' split breaks
    tmpArray() = Split(tmpTxt, "
")
    lblNews.Caption = vbNullString
    For I = 0 To UBound(tmpArray)
      lblNews.Caption = lblNews.Caption & tmpArray(I) & vbNewLine
    Next
```You know what? Erase it all. Yes, don't worry, trust me, it will not be used.

4-And now replace it with
```
txtNews.LoadFile App.Path & "\data files\news.rtf", rtfRTF
```
And that's it. Now, just remember to create a rtf file named _'news'_. You can create rtf files with either MSWord, WordPad, OpenOfficeWriter, whatever. Any word processor will do it (not sure if WordPerfect would).
(By now, I think that the news files are updated only when you update the client itself, like using some auto-updater or something, so take it in consideration when "composing" your honourable and very well presented news)

–~~--
As for screenshots, well, just imagine a RTF file instead of plain text.

Thanks for your time,
L'ark Mitsinikos
Link to comment
Share on other sites

I forgot something. You can also use SamuGames' transparent chatbox tutorial to make the RichTextbox… transparent. That is if that plain background color mess up your stylish GUI.

[The link to Samu's tutorial](http://www.touchofdeathforums.com/smf/index.php/topic,68816.0.html)

Well, that's it,
L'ark Mitsinikos
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...