Jacquelinett Posted May 1, 2011 Author Share Posted May 1, 2011 hey, i was trying to make my chatbox transparent, here is what i have done.in mod type```' AlphaBlendPublic Type BLENDFUNCTION BlendOp As Byte BlendFlags As Byte SourceConstantAlpha As Byte AlphaFormat As ByteEnd TypePublic Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As LongPublic Declare Sub RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long)```modGameLogic```Public Sub ChatBlend()'AlphaBlend for chatbox Dim BF As BLENDFUNCTION, lBF As Long 'Set the graphics mode to persistent frmMain.Picture8.Picture = LoadPicture(App.Path & "\data files\graphics\gui\main\chatbox_text.jpg") frmMain.Picture8.AutoRedraw = True frmMain.picScreenBuffer.AutoRedraw = True 'set the parameters With BF .BlendOp = AC_SRC_OVER .BlendFlags = 0 .SourceConstantAlpha = 128 .AlphaFormat = 0 End With 'copy the BLENDFUNCTION-structure to a Long RtlMoveMemory lBF, BF, 4 ' frmMain.picScreenBuffer.Picture = 'AlphaBlend the picture from Picture1 over the picture of Picture2 AlphaBlend frmMain.Picture8.hdc, 0, 0, frmMain.Picture8.ScaleWidth, frmMain.Picture8.ScaleHeight, frmMain.picScreenBuffer.hdc, frmMain.Picture8.Left, frmMain.Picture8.top, frmMain.Picture8.ScaleWidth, frmMain.Picture8.ScaleHeight, lBFEnd Sub```modConstants:```'Declarations/Functions for Transparent Rich Text BoxsPublic Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPublic Const GWL_EXSTYLE = (-20)Public Const WS_EX_TRANSPARENT = &H20&'Alpha BlendPublic Const AC_SRC_OVER = &H0```frmMain, sub formload``` Dim TransRichText As Long TransRichText = SetWindowLong(txtChat.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)``` *****************replace the ** Render graphic ** with this: *****************``` Call Render_Graphics If Options.ChatBlend = 1 Then Call ChatBlend End If frmMain.txtChat.Refresh DoEvents frmMain.txtChat.Refresh ' Lock fps If Not FPS_Lock Then Do While GetTickCount < Tick + 15 DoEvents Sleep 1 frmMain.txtChat.Refresh Loop End If ' Calculate fps If TickFPS < Tick Then GameFPS = FPS TickFPS = Tick + 1000 FPS = 0 Else FPS = FPS + 1 End If Loop frmMain.Visible = False If isLogging Then isLogging = False frmMain.picScreen.Visible = False frmMenu.Visible = True GettingMap = True StopMidi PlayMidi Options.MenuMusic Else ' Shutdown the game frmLoad.Visible = True Call SetStatus("Destroying game data...") Call DestroyGame End If```There…That what i did, but the chatbox is still not transparent, any idea?btw, picture 8 is the picture box that contain the chat Link to comment Share on other sites More sharing options...
Jacquelinett Posted May 4, 2011 Author Share Posted May 4, 2011 bump Link to comment Share on other sites More sharing options...
Robin Posted May 4, 2011 Share Posted May 4, 2011 That is ridiculously convoluted. As far as I can remember you simply need to set the procedure running once when the form loads. It does not need to be in a loop… especially not twice. Link to comment Share on other sites More sharing options...
Jacquelinett Posted May 4, 2011 Author Share Posted May 4, 2011 so you mean i should simply add a produce to the formload? Link to comment Share on other sites More sharing options...
Robin Posted May 4, 2011 Share Posted May 4, 2011 I mean you should remove everything you have and simply SetWindowLong on load. Once. None of this loop bullshit you have going on. You also don't need that alpha API you've added in. Link to comment Share on other sites More sharing options...
Jacquelinett Posted May 4, 2011 Author Share Posted May 4, 2011 umh… it said that "argument not optional" when i added it to frmMain and compile it Link to comment Share on other sites More sharing options...
Jacquelinett Posted May 7, 2011 Author Share Posted May 7, 2011 bump Link to comment Share on other sites More sharing options...
Robin Posted May 7, 2011 Share Posted May 7, 2011 Then try something else. >_> Link to comment Share on other sites More sharing options...
Jacquelinett Posted May 7, 2011 Author Share Posted May 7, 2011 common robin, give me some help :( i worked hard on this… Link to comment Share on other sites More sharing options...
Robin Posted May 7, 2011 Share Posted May 7, 2011 I'm afraid games don't magically get developed because you 'work hard'.There are 1,000s of examples of how to make an RTB transparent around the web. Take any of them and implement it _properly_ (meaning you don't just copy & paste the code around willy-nilly) and you'll be golden. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now