Page 2 of 2 FirstFirst 12
Results 41 to 69 of 69

Thread: Simple Transparent Frame User Control v1.14

  1. #41
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Thumbs up Re: Simple Transparent Frame User Control v1.09

    thanks again

    you have saved me from much trouble

    i this i'll try this one

  2. #42
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.09

    oops you removed the code why?

  3. #43

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.09

    Quote Originally Posted by coolcurrent4u View Post
    oops you removed the code why?
    Adding some properties to XP_Framez control, like Font, Colors, just a few basics. PM sent.

  4. #44
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.09

    ok thanks. waiting......

  5. #45

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.09

    Quote Originally Posted by coolcurrent4u View Post
    ok thanks. waiting......
    Try this demo and let me know how it works out for you.
    Attached Files Attached Files

  6. #46
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.09

    thanks again for you bright idea

  7. #47

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.09

    Updated the Framez control to v1.12.
    Added WinXP/Win7 to Frame Styles.
    Also includes an updated demo of the TabStrip Experiment, the Windows XP frame style now looks correct.
    Last edited by Edgemeal; Jun 5th, 2009 at 02:32 PM.

  8. #48

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.09

    Quote Originally Posted by coolcurrent4u View Post
    thanks again for you bright idea
    Glad I could help, though it looks great under WinXP that gradient look isn't used under Win7.

    I was just playing with Windows 7 RC and the styles are different, the TabStrip no longer has that gradient look in its body, that area is all white. The Frames also look a little different, Win7 frames are single line too but with a less rounded corner. Not sure if it is the same way in Vista or not, haven't played with Vista much at all.
    Last edited by Edgemeal; Jun 4th, 2009 at 07:19 PM.

  9. #49
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.12

    windows 7 or vista? whats d difference am using xp

  10. #50
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.12

    so for win7 what do you suggest

  11. #51

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by coolcurrent4u View Post
    so for win7 what do you suggest
    If we wanted the tabstrip experiment project to match the OS (as close as possible) we'd first check to see what OS is running, if its Vista or Win7 then we don't apply the gradient to the pic box container and leave it as a solid white, and set the style of the v1.1.2 Framez control to Win7.

    I looked at some screen shots of Vista and Win7 and the tabstrip and frame look the same to me, though depending on the theme selected I'm sure the colors will change. If you really want your program to match the OS style at all times you really need to look at theme aware type controls, or possibly subclass so your project always knows if the theme/colors have changed and apply the needed changes to your controls.
    Last edited by Edgemeal; Jun 7th, 2009 at 02:54 PM.

  12. #52
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Simple Transparent Frame User Control v1.12

    and just how do i do that?

    you know i was just wandering if all this effort is not too much for just the frame control
    remeber that the initial aim was to make the frame control look transparent. i had a code that does that but was slower when i had like three or four frame controls on a tabstrip

  13. #53

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by coolcurrent4u View Post
    and just how do i do that?

    you know i was just wandering if all this effort is not too much for just the frame control
    remeber that the initial aim was to make the frame control look transparent. i had a code that does that but was slower when i had like three or four frame controls on a tabstrip
    Probably best if you search and ask those specific questions in the vb6 & earlier forum.

  14. #54
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Simple Transparent Frame User Control v1.12

    Also remember there are different themes available: the best way to go is to use the theme drawing APIs or hack around the default Windows controls (group box in this case), but that requires advanced knowledge and tricks.

    Code:
    Private Declare Sub GetMem4 Lib "msvbvm60" (ByVal Ptr As Long, Value As Long)
    
    ' ..
    
    Dim lnghWnd As Long
    GetMem4 ObjPtr(Frame1) + 68, lnghWnd
    This is how you get the hWnd of the native VB frame (and actually any VB control that must have a hWnd in the first place).

  15. #55
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Question Re: Simple Transparent Frame User Control v1.12

    i got this themeing project from vbaccelerator but i don't know how to use it. the theming program is to help anyone doing themming

    as regards theming which do you think would be better


    app theming or windows theming

  16. #56
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Simple Transparent Frame User Control v1.12

    This relates to this topic a bit so I'm posting this here. I hacked around a bit to figure out if I could have an alpha transparent frame. I got it somewhat working but I don't have the time to play with this further.

    Two issues: 1) the control does not move when the form is moved and 2) the z-index is lost, I don't know if it is possible to restore it while maintaining alpha transparency.

    It is a hack that relies on SetParent, because normally you can't use SetLayeredWindow on a child window of another window, you can only use it to top level windows.

    Start a new project, add Frame1 and paste:
    Code:
    Option Explicit
    
    Private Const GWL_EXSTYLE = -20
    Private Const GWL_STYLE = -16
    Private Const LWA_ALPHA = &H2
    Private Const WS_CHILD = &H40000000
    Private Const WS_EX_LAYERED = &H80000
    
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    
    Private Declare Sub GetMem4 Lib "msvbvm60" (ByVal Ptr As Long, Value As Long)
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long) As Long
    
    Private Sub Form_Resize()
        Static lngWnd As Long, udtRect As RECT, udtRectP As RECT
        Dim udtRectPN As RECT
        If lngWnd = 0 Then
            GetMem4 ObjPtr(Frame1) + 68, lngWnd
            GetWindowRect lngWnd, udtRect
            GetWindowRect Me.hWnd, udtRectP
            SetParent lngWnd, 0
            SetWindowLong lngWnd, GWL_EXSTYLE, GetWindowLong(lngWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
            SetLayeredWindowAttributes lngWnd, 0, 50, LWA_ALPHA
            'MoveWindow lngWnd, udtRect.Left - udtRectPN.Left, udtRect.Top - udtRectPN.Top, udtRect.Right - udtRect.Left, udtRect.Bottom - udtRect.Top, 0
            SetParent lngWnd, Me.hWnd
        Else
            GetWindowRect Me.hWnd, udtRectPN
            udtRectPN.Left = udtRectP.Left - udtRectPN.Left
            udtRectPN.Top = udtRectP.Top - udtRectPN.Top
            'SetWindowLong lngWnd, GWL_EXSTYLE, GetWindowLong(lngWnd, GWL_EXSTYLE) And Not WS_EX_LAYERED
        End If
        SetWindowPos lngWnd, 1, udtRect.Left - udtRectPN.Left, udtRect.Top - udtRectPN.Top, udtRect.Right - udtRect.Left, udtRect.Bottom - udtRect.Top, 0
    End Sub
    Happy hacking if someone catches this up and tries to get it to work.


    Edit!
    It still doesn't maintain zindex, but it is possible to have the transparent window behind other controls! Now the hard part is tracking window movement...
    Last edited by Merri; Jun 10th, 2009 at 04:47 PM.

  17. #57

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by Merri View Post
    Happy hacking if someone catches this up and tries to get it to work.
    This would be a sort of a cool effect for disabling a frame since you can't click on any of the controls inside the frame when you apply this code.

  18. #58
    Junior Member seba.kwiat's Avatar
    Join Date
    Jun 2009
    Posts
    30

    Re: Simple Transparent Frame User Control v1.12

    Framez doesnt support tooltiptext for labels does anyone know how to fix this issue?
    I need that label for making check boxes and option boxes transparent.
    Instead of tooltiptex from label i could show tooltiptext of check box or option if i know how to do that programically.

    thx
    Last edited by seba.kwiat; Jun 15th, 2009 at 07:46 AM.

  19. #59

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by seba.kwiat View Post
    Framez doesnt support tooltiptext for labels does anyone know how to fix this issue?
    I need that label for making check boxes and option boxes transparent.
    Instead of tooltiptex from label i could show tooltiptext of check box or option if i know how to do that programically.

    thx
    That problem doesn't have anything to do with the Framez control in particular, if you create a new usercontrol and set it as a container you'll see the lable control (even if set to opaqe) doesn't show it's tooltip, though I'm not sure why.

    Unless someone knows why and a solution I'd suggest trying something else for your tooltips, like a ballon tooltip class (copy of the class posted here) instead. You wont have that problem with labels then and have nicer looking tooltips also IMO.

    btw, to use a label with that class you would pass the labels container handle since a label doesn't have a handle.

  20. #60
    Junior Member seba.kwiat's Avatar
    Join Date
    Jun 2009
    Posts
    30

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by Edgemeal View Post
    That problem doesn't have anything to do with the Framez control in particular, if you create a new usercontrol and set it as a container you'll see the lable control (even if set to opaqe) doesn't show it's tooltip, though I'm not sure why.

    Unless someone knows why and a solution I'd suggest trying something else for your tooltips, like a ballon tooltip class (copy of the class posted here) instead. You wont have that problem with labels then and have nicer looking tooltips also IMO.

    btw, to use a label with that class you would pass the labels container handle since a label doesn't have a handle.
    Thanks for your reply.

    you can not use that class because labels has no hwnd but i solved the problem by placing the label inside the picturebox. I set the labels to transparent and i cut out picturebox from the backgrount so it all looks transparent and tooltip works fine on that.

  21. #61

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Quote Originally Posted by seba.kwiat View Post
    you can not use that class because labels has no hwnd
    You can use that tooltip class on labels, as I said you need to use the labels container hWnd.

    I use this sub to set/show the tooltip, then use it like this...
    Code:
    ' Lable1 inside Framez1 control...
    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ShowToolTip  "ToolTip Here", Framez1.hWnd, "Title Here"
    End Sub
    EDIT btw, The Framez control posted here doesn't have a MouseMove event, which you'd most likely need so you can reset that balloon tip class.
    Add a simple MouseMove event to the Framez control...
    Code:
    ' General Declares
    Event MouseMove()
    
    ' code
    Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        RaiseEvent MouseMove
    End Sub
    Last edited by Edgemeal; Jun 30th, 2009 at 06:11 AM.

  22. #62

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.12

    Updated:
    v1.14 - Fix(v1.12): Selecting a system color for XP\7 border color was always black.
    v1.13 - Add option to disable transparency and set background color.
    Note: Transparency is now disabled by default in v1.13 and later.
    Last edited by Edgemeal; Oct 9th, 2009 at 07:01 PM.

  23. #63
    Junior Member
    Join Date
    Nov 2009
    Posts
    19

    Re: Simple Transparent Frame User Control v1.14

    can you tell me how to apply it in my form if ever i want it to apply on my own form please?

  24. #64
    Junior Member
    Join Date
    Nov 2009
    Posts
    19

    Re: Simple Transparent Frame User Control v1.14

    can you tell me how to apply it in my own form...i try'd to add your ActiveX Control but its not working it keeps my frame in my form untransparent...what should i do?..please help me

  25. #65
    Junior Member seba.kwiat's Avatar
    Join Date
    Jun 2009
    Posts
    30

    Re: Simple Transparent Frame User Control v1.14

    Quote Originally Posted by ohailo View Post
    can you tell me how to apply it in my own form...i try'd to add your ActiveX Control but its not working it keeps my frame in my form untransparent...what should i do?..please help me
    you have to add this control to your controls then you will see new control which you apply on the form the same way as the others eg. label etc.

    cheers

  26. #66
    Addicted Member
    Join Date
    Aug 2008
    Posts
    136

    Re: Simple Transparent Frame User Control v1.14

    Hi Edgemeal,

    i played with your TabStrip Demo For WinXP. i like this, but actually i wanted my form is resizeable and the tabstrip and the frame as well. but when i use Form_Resize, then the frame is error, saying Can't create AutoRedraw image..

    is there a way to solve this?
    thank you very much..

  27. #67

    Thread Starter
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Simple Transparent Frame User Control v1.14

    Quote Originally Posted by edhanz View Post
    Hi Edgemeal,

    i played with your TabStrip Demo For WinXP. i like this, but actually i wanted my form is resizeable and the tabstrip and the frame as well. but when i use Form_Resize, then the frame is error, saying Can't create AutoRedraw image..

    is there a way to solve this?
    thank you very much..
    Might want to upload a demo of your code, in the meantime here is a quick re-size test I did and didn't see that problem.
    Attached Files Attached Files

  28. #68
    Addicted Member
    Join Date
    Aug 2008
    Posts
    136

    Re: Simple Transparent Frame User Control v1.14

    yes it works as i wanted..
    thank you very much..

  29. #69
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,540

    Re: Simple Transparent Frame User Control v1.14

    After years of searching, I finally found a transparent control.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width