Mirage Source
Transparent Rich Text Box - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Transparent Rich Text Box (/showthread.php?tid=4)

Pages: 1 2


Transparent Rich Text Box - William - 29-05-2006

Difficulty: 1/5

Put this in modDeclares:

Code:
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20&

And put this in Form_Load in the form that has the rich text box that you want transparent:
Code:
Dim result As Long
result = SetWindowLong(txtChat.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)

txtChat is the name of the rich text box. Done!


- Rian - 30-05-2006

This just doesn't seem to work :?

First of all, I could only get the code to run by placing

Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Into frmMirage code.

After that though, it still didn't work. Are there some sort of specific settings the rich text box needs in order for this to work?


- Obsidian - 30-05-2006

Change

Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

The Private Part... Just Make it Public so it works with the entire project, not just individual codes. As far as the rest goes... i haven't tested it yet, but i'll try it out later and see what's going on.


- William - 30-05-2006

Ohh, yeah in my source Im using:

Code:
Private Declare Function SetWindowLong
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
'
Because I have that in the same form as the rich text box.

And forgot to make it Public. Tutorial Fixed.


- Da Undead - 17-05-2007

This doesnt work Sad


- Matt - 17-05-2007

Yes this does work. Perfectly. Just follow the very first part of the tut, if you don't try to add anything else and do exactly what it says, it works perfectly.


- William - 17-05-2007

Of Course it works, its my tut Tongue


- Da Undead - 17-05-2007

well when i put the chatbox over the game screen and tested it, it only show up when i say something and it'll be on for like .5 seconds... and it wasn't transparent. Sad


- Rezeyu - 17-05-2007

Then you did something wrong.

If it keeps refreshing then the txtbox must be updating over and over, which means you're sending soemthing to that box too often.

Or something.




In any case, it does work, You can look at the screenshots of my transparent boxes in the gallery section.


- Da Undead - 18-05-2007

Well doesn't work for me :\

Could be fact that im using elysium debugged tho.. heh


- Ramsey - 18-05-2007

Da Undead Wrote:Well doesn't work for me :\

Could be fact that im using elysium debugged tho.. heh

Personally, I don't like Elysium DeBugged. I like an almost completely empty source like Mirage Source because you can customize more things and it makes your game unique. Elysium DeBugged has a lot of features but it doesn't give you the pride of making it.


- Matt - 18-05-2007

This won't work directly over a blitted area. You have to blit it to the screen if you want that, instead of doing this. If you try this, over a textured picture box, you will see that it works perfectly.


- William - 18-05-2007

Advocate Wrote:This won't work directly over a blitted area. You have to blit it to the screen if you want that, instead of doing this. If you try this, over a textured picture box, you will see that it works perfectly.
Exactly.


- Braydok - 23-05-2007

That explains my problem.
How would one go about blitting this to the screen?


- Matt - 23-05-2007

Roughly the way the player name is blitted.


- William - 23-05-2007

Braydok Wrote:That explains my problem.
How would one go about blitting this to the screen?
Basicly the same way rhe defult text is blitted when you ttýpe.


Re: Transparent Rich Text Box - Da Undead - 22-06-2007

I put this on top of frmMirage code

Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&

And here my form_load sub..

Code:
Private Sub Form_Load()
Dim i As Long
Dim Ending As String
Dim result As Long
result = SetWindowLong(txtChat.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)

    For i = 1 To 3
        If i = 1 Then Ending = ".gif"
        If i = 2 Then Ending = ".jpg"
        If i = 3 Then Ending = ".png"

        If FileExist("GUI\Game" & Ending) Then frmMirage.Picture = LoadPicture(App.Path & "\GUI\Game" & Ending)
    Next i
    
    frmMainMenu.Visible = False
End Sub

No work Sad


Re: - Rezeyu - 23-06-2007

Perfekt Wrote:This won't work directly over a blitted area. You have to blit it to the screen if you want that, instead of doing this. If you try this, over a textured picture box, you will see that it works perfectly.



Re: Transparent Rich Text Box - Da Undead - 23-06-2007

Im trying to get it transparent over the GUI picture =\.


Re: Transparent Rich Text Box - Reece - 23-06-2007

Da Undead Wrote:Im trying to get it transparent over the GUI picture =\.

Have you downloaded MSE and seen if it works in there? If it does, its your fault.


Re: Transparent Rich Text Box - Da Undead - 23-06-2007

No, but it should work because its not using variables from elysium....

Could it have to do with the name of it?

Private Sub Form_Load()

?


Re: Transparent Rich Text Box - Coke - 23-06-2007

:lol:


Re: Transparent Rich Text Box - Da Undead - 24-06-2007

I mean like should it be like Public Sub cuz i never learned wat difference was between Private and Public heh..


Re: Transparent Rich Text Box - Coke - 24-06-2007

Private means its specific to that module or form, no other forms or modules can call it,

public means it can be called from any other form or module

:]


Re: Transparent Rich Text Box - Robin - 24-06-2007

Seen as though the other code is initialised in that sub, it's something else you've done.