Mirage Source
http://miragesource.net/forums/

Transparent Rich Text Box
http://miragesource.net/forums/viewtopic.php?f=210&t=8
Page 1 of 3

Author:  William [ Mon May 29, 2006 1:49 pm ]
Post subject:  Transparent Rich Text Box

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!

Author:  Rian [ Tue May 30, 2006 2:16 am ]
Post subject: 

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?

Author:  Obsidian [ Tue May 30, 2006 4:34 am ]
Post subject: 

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.

Author:  William [ Tue May 30, 2006 7:40 am ]
Post subject: 

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.

Author:  Da Undead [ Thu May 17, 2007 2:03 am ]
Post subject: 

This doesnt work :(

Author:  Matt [ Thu May 17, 2007 10:57 am ]
Post subject: 

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.

Author:  William [ Thu May 17, 2007 3:48 pm ]
Post subject: 

Of Course it works, its my tut :P

Author:  Da Undead [ Thu May 17, 2007 11:39 pm ]
Post subject: 

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. :(

Author:  Rezeyu [ Thu May 17, 2007 11:53 pm ]
Post subject: 

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.

Author:  Da Undead [ Fri May 18, 2007 12:33 am ]
Post subject: 

Well doesn't work for me :\

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

Author:  Ramsey [ Fri May 18, 2007 2:12 am ]
Post subject: 

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.

Author:  Matt [ Fri May 18, 2007 3:03 am ]
Post subject: 

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.

Author:  William [ Fri May 18, 2007 12:25 pm ]
Post subject: 

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.

Author:  Braydok [ Wed May 23, 2007 8:49 pm ]
Post subject: 

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

Author:  Matt [ Wed May 23, 2007 8:51 pm ]
Post subject: 

Roughly the way the player name is blitted.

Author:  William [ Wed May 23, 2007 10:57 pm ]
Post subject: 

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.

Author:  Da Undead [ Fri Jun 22, 2007 11:54 pm ]
Post subject:  Re: Transparent Rich Text Box

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 :(

Author:  Rezeyu [ Sat Jun 23, 2007 12:53 am ]
Post subject:  Re:

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.

Author:  Da Undead [ Sat Jun 23, 2007 2:34 am ]
Post subject:  Re: Transparent Rich Text Box

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

Author:  Reece [ Sat Jun 23, 2007 6:53 pm ]
Post subject:  Re: Transparent Rich Text Box

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.

Author:  Da Undead [ Sat Jun 23, 2007 9:28 pm ]
Post subject:  Re: Transparent Rich Text Box

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()

?

Author:  Coke [ Sat Jun 23, 2007 11:25 pm ]
Post subject:  Re: Transparent Rich Text Box

:lol:

Author:  Da Undead [ Sun Jun 24, 2007 12:03 am ]
Post subject:  Re: Transparent Rich Text Box

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

Author:  Coke [ Sun Jun 24, 2007 12:13 am ]
Post subject:  Re: Transparent Rich Text Box

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

:]

Author:  Robin [ Sun Jun 24, 2007 3:55 pm ]
Post subject:  Re: Transparent Rich Text Box

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

Page 1 of 3 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/