Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent Richtextbox

Status
Not open for further replies.

codecref

Programmer
Dec 8, 2003
118
0
0
US
Hi guys
I have this richtextbox transparent over a Picturebox which the Picutrebox is a container for a Video playback using ActiveMovie.
Richtextbox is actually suppose to show Subtitle over it. but the problem is that (in some case only) after I change the text, the old text will remain while new text is drawing, I suppose it has something to do with autoredraw which we don't have it in .net , any help about this?

This is how I made it transparent:

Code:
    Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _
                        (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
    Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" _
                        (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
    Private Const GWL_EXSTYLE As Integer = -20
    Private Const WS_EX_TRANSPARENT As Integer = &H20&
    Private Const HWND_TOP As Integer = 0

    Private Sub Preview_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Dim x As Integer = GetWindowLong(SubLayer.Handle.ToInt32, GWL_EXSTYLE)
        x = x Or WS_EX_TRANSPARENT
        SetWindowLong(SubLayer.Handle.ToInt32, GWL_EXSTYLE, x)
        SubLayer.BringToFront()
End Sub

Any help is highly appreciated
 
Richtextbox doesn't support transparent in .NET. Maybe this is the reason you don't see it well. Why not using a label control and set the back color to transparent?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top