Page 1 of 2 12 LastLast
Results 1 to 40 of 69

Thread: Simple Transparent Frame User Control v1.14

  1. #1

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

    Simple Transparent Frame User Control v1.14

    Just a simple transparent Frame (container) control.
    Place control on a Form or inside a Picture box that has an image.

    Properties: Caption, BackColor, BorderColor(XP/7 styles), FrameStyle, Font, ForeColor, ForeColorDisabled, Transparent, and Enable.

    v1.14 - Fix: Selecting a system color for XP\7 border color was always black.
    v1.13 - Add option to disable transparency and set background color.
    v1.12 - Add Windows XP/7 frame styles. (includes TabStrip Demo for XP Style)
    v1.09 - Fix bugs in v1.06 to v1.08. (support and fix Framez inside of Framez)
    v1.05 - General usage.

    Notes:
    Vista and Windows 7 have the same look for frames.
    Transparency is now disabled by default in v1.13 and greater.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by Edgemeal; Oct 9th, 2009 at 01:48 PM. Reason: Updated to v1.14

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    Nice, real nice.

  3. #3

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

    Re: Simple Transparent Frame User Control

    v1.05 -
    Caption now changes as you type in design mode.
    Simplified Font code.
    Demo includes 2 pictures and how to update background of frames.

  4. #4
    New Member
    Join Date
    Dec 2007
    Posts
    14

    Transparent User Control That display Gif /Animated file

    hi,

    I have a task to display a transparent user control that display gif / animated file. Currently I am using a webbrowser control in a user control.

    But the problem is, the webbrowser doesn't have the transparent property. As such my gif file always has a solid white background, against the container's image background.

    May I know what is the alternative ways?

    Thanks and best regards,

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    The WebBrowser does display transparent gif images. Are you sure your gif image has a transparent background? Post your gif image and I will test it with my WebBrowser

  6. #6

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

    Re: Transparent User Control That display Gif /Animated file

    Quote Originally Posted by johnliang
    But the problem is, the webbrowser doesn't have the transparent property. As such my gif file always has a solid white background, against the container's image background.
    For animated Gifs you might want to take a look at LaVolpe's Animated Image Control

  7. #7
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    Program has error running in design mode.

    Run-time error '398'
    Client-Site not available

    Code:
    Private Function ManageTimers(ByVal Mode As Long) As Boolean
    
        If Mode = 0 Then
            If UserControl.Ambient.UserMode = True Then KillTimer c_tmrOwner c_tmrOwner, ObjPtr(Me)
            c_aniState = gfaStop
        Else
         '
         '
         '
         '
         '
    End Function
    Last edited by jmsrickland; Nov 24th, 2008 at 12:36 PM.

  8. #8

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

    Re: Simple Transparent Frame User Control

    Quote Originally Posted by jmsrickland
    Program has error running in design mode.
    Run-time error '398'
    Client-Site not available
    Please use quotes so people reading your replies know who/what you are referring/replying to.
    I assume you are talking about LaVolpe's Animated Image Control I posted a link to, I don't get any errors like that here.

  9. #9
    New Member
    Join Date
    Dec 2007
    Posts
    14

    Re: Simple Transparent Frame User Control

    Quote:
    Originally Posted by Edgemeal
    For animated Gifs you might want to take a look at LaVolpe's Animated Image Control

    Thanks Edgemeal. It looked useful to me. Cheers.


    Quote:
    Originally Posted by jmsrickland
    The WebBrowser does display transparent gif images. Are you sure your gif image has a transparent background? Post your gif image and I will test it with my WebBrowser

    As requested, attached is the gif file. Thanks.
    Attached Images Attached Images  
    Last edited by johnliang; Nov 24th, 2008 at 08:27 PM.

  10. #10
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    Well I see that your gif is transparent (I can't test it because it is not the .gif file attached) but for a fact WebBrowser displays all transparent gif images as transparent so I don't know what your problem could be but if you can use LaVolpe's program then go for it.

  11. #11
    New Member
    Join Date
    Dec 2007
    Posts
    14

    Re: Simple Transparent Frame User Control

    hi jmsrickland,

    thanks for your help. my problem is i have created a uc which has a webbrowser control. this webbrowser control will display a gif animated file.

    secondly i have a picturebox which has a background picture.

    I put the webbrowser uc into this picturebox container. It is supposed to display the animated gif over the background picture. But instead, it displays the gif with a white solid background thereby covering the picturebox's background image.

    Is there any solution?

    Rgrds,

  12. #12
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    Still not completely understanding this.

    OK, you have a UC. The UC has a WebBrowser Control in it. That is all, right? OK, the WebBrowser in the UC can display the animated gif correctly, right?

    So now you take this UC and put it in a Picturebox which is on the parent Form, right?

    The Picturebox already has a picture in it as the background. Now wouldn't putting the UC inside the Picturebox cover the background picture? I think so.

    OK, here is where I get lost. Putting the UC inside the Picturebox. What do you expect it to do? The UC sits on top of the background picture of the Picturebox. Am I getting this wrong? But the gif image inside the WebBrowser still shows as a transparent image. What am I missing here?

  13. #13
    New Member
    Join Date
    Dec 2007
    Posts
    14

    Re: Simple Transparent Frame User Control

    You are right on all your assumptions.

    Basically I want the animated gif to be displayed on top of the picturebox with the picturebox's image as its background.

    I see your point that the webbrowser (being not tranparent) will block the image of the picturebox underneath.

    The reason I use put the webbrowser control on the uc is because I wish to be able to position the gif, to set the webbrowser scrollbars off and to display image in flat border mode (not 3D) during runtime, therefore using the uc to perform these functions.

    All gif parameters are read from an external xml file.

  14. #14
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control

    Basically I want the animated gif to be displayed on top of the picturebox with the picturebox's image as its background.

    I think this is going to be a problem. As a rule, Pictureboxes do not have the ability to display a transparent gif image. There might be some code around here and perhaps the code is in LaVolpe's program that can emulate, so the speak, the effect of a transparent image in a Picturebox but I don't know what that code is but I bet there is some. But like I said, without some special technique you simply cannot display a transparent image in a Picturebox.

    Why don't you make the WebBrowser's background the picture you want and put the animated gif on top of that? Wouldn't that work as well?

    Make your document like this....
    Code:
    <html>
    <body background="background_picture.jpg">
    <img src="animated.gif">
    </body>
    </html>
    ....and load this into the WebBrowser UserControl.

  15. #15
    New Member
    Join Date
    Dec 2007
    Posts
    14

    Re: Simple Transparent Frame User Control

    thanks for all your constructive feedbacks. I will keep those comments in mind.
    you all have been very kind.

    cheers.

  16. #16
    New Member
    Join Date
    Jan 2009
    Posts
    10

    Re: Simple Transparent Frame User Control

    Hi,

    Nice Control, really useful.

    Just one thing thou...

    I am trying to include this frame in an activex control, but the redraw method does not seem to work. Do you have any ideas?

    Thanks in advance!

  17. #17

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

    Re: Simple Transparent Frame User Control

    Quote Originally Posted by broc028 View Post
    Hi,

    Nice Control, really useful.

    Just one thing thou...

    I am trying to include this frame in an activex control, but the redraw method does not seem to work. Do you have any ideas?

    Thanks in advance!
    Sorry for not replying sooner, I'm not sure I know the correct answer, my guess is the control you are putting my transparent framez UC into doesn't have the needed properties for the BitBlt call, like a .hDC, .ScaleMode, .ScaleX and .ScaleY.

    I recently ran into that same problem and added this to my main container control.

    Code:
    Public Property Get hDC() As Long
        hDC = UserControl.hDC
    End Property
    
    Public Property Get ScaleMode() As ScaleModeConstants
        ScaleMode = UserControl.ScaleMode
    End Property
    see post #23 for the rest
    Last edited by Edgemeal; May 10th, 2009 at 02:27 PM.

  18. #18

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

    Re: Simple Transparent Frame User Control v1.07

    v1.06 & v1.07 didn't work correctly when put into a Picture Box, forgot to set AutoReDraw.
    Last edited by Edgemeal; May 2nd, 2009 at 04:36 AM.

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

    Re: Simple Transparent Frame User Control

    Quote Originally Posted by Edgemeal View Post
    Sorry for not replying sooner, I'm not sure I know the correct answer, my guess is the control you are putting my transparent framez UC into doesn't have the needed properties for the BitBlt call, like a .hDC, .ScaleMode, .ScaleX and .ScaleY.

    I recently ran into that same problem and added this to my main container control.

    Code:
    Public Property Get hDC() As Long
        hDC = UserControl.hDC
    End Property
    
    Public Property Get ScaleMode() As ScaleModeConstants
        ScaleMode = UserControl.ScaleMode
    End Property
    
    Public Property Get ScaleX(Width As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleX = UserControl.ScaleX(Width, FromScale, ToScale)
    End Property
    
    Public Property Get ScaleY(Height As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleY = UserControl.ScaleY(Height, FromScale, ToScale)
    End Property

    But to get my framez control to show up properly inside other framez I had to also divide the Extender.Left & .Top values by Screen.TwipsPerPix... too, though I thought the scaleX/Y would of taken care of that, weird.

    Can you pls upload a copy of what you did for others 2 share

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

    Re: Simple Transparent Frame User Control v1.08

    Quote Originally Posted by Edgemeal View Post
    Just a simple transparent Frame (container) control.
    Place control on a Form or inside a Picture box that has an image.
    Properties: Caption, FrameStyle, Font, ForeColor, ForeColorDisabled and Enable.
    The control doesnt seem to be transparent to me.

    Place it on a tabstrip and compile with xp style to see what i mean
    Attached Images Attached Images  

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

    Re: Simple Transparent Frame User Control

    Quote Originally Posted by Edgemeal View Post
    Sorry for not replying sooner, I'm not sure I know the correct answer, my guess is the control you are putting my transparent framez UC into doesn't have the needed properties for the BitBlt call, like a .hDC, .ScaleMode, .ScaleX and .ScaleY.

    I recently ran into that same problem and added this to my main container control.

    Code:
    Public Property Get hDC() As Long
        hDC = UserControl.hDC
    End Property
    
    Public Property Get ScaleMode() As ScaleModeConstants
        ScaleMode = UserControl.ScaleMode
    End Property
    
    Public Property Get ScaleX(Width As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleX = UserControl.ScaleX(Width, FromScale, ToScale)
    End Property
    
    Public Property Get ScaleY(Height As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleY = UserControl.ScaleY(Height, FromScale, ToScale)
    End Property

    But to get my framez control to show up properly inside other framez I had to also divide the Extender.Left & .Top values by Screen.TwipsPerPix... too, though I thought the scaleX/Y would of taken care of that, weird.

    Can you please place or upload a copy of what you did so i could see it. you said you got it to work.

  22. #22

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

    Re: Simple Transparent Frame User Control v1.08

    Quote Originally Posted by coolcurrent4u View Post
    The control doesnt seem to be transparent to me.

    Place it on a tabstrip and compile with xp style to see what i mean
    Might be easier if you uploaded a sample demo project of just that tabstrip with the xp style for me to play with.

  23. #23

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

    Re: Simple Transparent Frame User Control

    Quote Originally Posted by coolcurrent4u View Post
    Can you please place or upload a copy of what you did so i could see it. you said you got it to work.
    Well the Framez control is in Pixel mode so I thought the above scaleX/Y code would work correctly but after trying some other controls inside the Framez (that call the scaleX/Y of its container) I noticed they weren't drawing correctly, so I changed the scaleX/Y code (Framez v1.09) and no longer need to check if a framez is inside another framez, so I guess my scalex/y properties above were wrong after all, at least for a UC that is set to pixel mode.

    Code:
    Public Property Get ScaleX(Width As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleX = UserControl.ScaleX(Width, FromScale, ToScale) / Screen.TwipsPerPixelX
    End Property
    
    Public Property Get ScaleY(Height As Single, FromScale As ScaleModeConstants, ToScale As ScaleModeConstants)
        ScaleY = UserControl.ScaleY(Height, FromScale, ToScale) / Screen.TwipsPerPixelY
    End Property
    I don't really get how UCs work, even though you set them to Pixel mode the cords act like they are in twips!
    Last edited by Edgemeal; May 3rd, 2009 at 11:14 AM.

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

    Re: Simple Transparent Frame User Control v1.09

    can you pls post a project example that uses xp style and the tabstrip control. am still battleing with you code
    Last edited by coolcurrent4u; May 17th, 2009 at 03:53 AM. Reason: typo

  25. #25

    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

    A vb tabstrip doesn't have a picture property nor does it have an .hDC that the Framez control needs. I'm puzzled why you need the frame to be transparent since the tabstrip isn't a container with a pic property to begin with.

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

    Question Re: Simple Transparent Frame User Control v1.09

    the control is not a container

    how do i make it one?

  27. #27
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Simple Transparent Frame User Control v1.09

    You dont. You can place other controls on top of it but you cannot make it the parent.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

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

    Re: Simple Transparent Frame User Control v1.09

    if i can't place controls on it, then its of no use.

  29. #29

    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

    Well the TabStrip control is not a container but the MS Tabbed Dialog control is.

    Why not just post a stripped down version of what it is you are trying to do so we can see it and maybe help better, post it in the vb6 earlier forum.

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

    Lightbulb Re: Simple Transparent Frame User Control v1.09

    Quote Originally Posted by Edgemeal View Post
    Well the TabStrip control is not a container but the MS Tabbed Dialog control is.

    Why not just post a stripped down version of what it is you are trying to do so we can see it and maybe help better, post it in the vb6 earlier forum.
    pls check this forum

    http://www.vbforums.com/showthread.p...29#post3529829

  31. #31

    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
    So far from what I can gather you want a transparent frame on top of a tabstrip control, but I can't understand why, when using the TabStrip control you would set your controls .Zorder, .Visible, .Container, etc,etc, properties to show, move, hide the controls when the tabstrip index changes.

    If you have objects/controls under the frame that you want to see you could just set their .Container property to the frame.

    I can only guess you are taking the wrong approach to achieve the desired result.. You still haven't attached any sample project so I'm done trying to guess.
    Last edited by Edgemeal; Jun 1st, 2009 at 11:56 PM.

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

    Question Re: Simple Transparent Frame User Control v1.09

    ok here is a sample project

    pls chk it out
    Attached Files Attached Files

  33. #33
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Simple Transparent Frame User Control v1.09

    I can't see the project above, because I've done a hard drive format and haven't installed VB yet, but I guess you're having the same problem as what I had in the topic below.

    http://www.vbforums.com/showthread.php?t=507336

    Simply put a Picturebox with a white backcolor on the TabStrip and make the backcolor of the Frame white as well. You will only lose the gradient backcolor of the TabStrip, but I don't think anybody will notice (see the difference between first and third picture in the topic above).

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

    Re: Simple Transparent Frame User Control v1.09

    i am already using this solution, but its not good for a proffesional looking app. i would'nt have bothre about making a frame control transparent anyway

  35. #35

    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

    Ok I think I see what you mean...,
    When you apply the XP style to the form the TabStrip control actually has a gradient look to it and you want the Frame background to match the TabStrip background.

    The only way I can think of doing that besides what you already tried in the other thread would be to use a picbox (or usercontrol) and draw the same looking gradient effect onto it, then draw the borders and caption for a XP style looking frame on top of that.
    Last edited by Edgemeal; Jun 2nd, 2009 at 05:58 PM.

  36. #36

    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

    Even if you get your transparent frame effect working you'll also have to make other controls like check & option boxes appear transparent too, I know it's not impossible just seems like a lot of work/resources to use up instead of just going with a solid background color for everything. Best of Luck!
    Attached Images Attached Images  

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

    Re: Simple Transparent Frame User Control v1.09

    can you send me this project to play with

  38. #38

    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
    can you send me this project to play with
    Have fun playing.
    Last edited by Edgemeal; Jun 8th, 2009 at 01:28 PM.

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

    Question Re: Simple Transparent Frame User Control v1.09

    thanks i'll play with it and see what i can do

    can't i enable theme in ur control?

    how do i do that

  40. #40

    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 i'll play with it and see what i can do

    can't i enable theme in ur control?

    how do i do that
    No, if you look at the Framez code it just uses the DrawEdge API, thats one of the reasons I called it "Simple".

    I just slapped together another transparent Framez control real quick just to see if I could draw a XP looking one, it's nothing special, you'll probably want to look at sites like Planet Source Code for controls that support themes to learn from, there are a lot of controls on that site.

    EDIT TabStrip_Experiment_2.zip Removed - Updates in Progress....
    .
    Last edited by Edgemeal; Jun 4th, 2009 at 03:24 PM. Reason: Attachment Removed - Updates in Progress

Page 1 of 2 12 LastLast

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