Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transparent Rich Text Box
#1
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!
Reply
#2
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?
Reply
#3
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.
Reply
#4
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.
Reply
#5
This doesnt work Sad
Reply
#6
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.
Reply
#7
Of Course it works, its my tut Tongue
Reply
#8
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
Reply
#9
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.
Reply
#10
Well doesn't work for me :\

Could be fact that im using elysium debugged tho.. heh
Reply
#11
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.
Reply
#12
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.
Reply
#13
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.
Reply
#14
That explains my problem.
How would one go about blitting this to the screen?
Reply
#15
Roughly the way the player name is blitted.
Reply
#16
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.
Reply
#17
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
Reply
#18
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.
Reply
#19
Im trying to get it transparent over the GUI picture =\.
Reply
#20
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.
Reply
#21
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()

?
Reply
#22
:lol:
Reply
#23
I mean like should it be like Public Sub cuz i never learned wat difference was between Private and Public heh..
Reply
#24
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

:]
Reply
#25
Seen as though the other code is initialised in that sub, it's something else you've done.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)