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.
Last edited by Edgemeal; Oct 9th, 2009 at 01:48 PM.
Reason: Updated to v1.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.
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
Re: Transparent User Control That display Gif /Animated file
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.
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.
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.
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.
Last edited by johnliang; Nov 24th, 2008 at 08:27 PM.
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.
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.
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?
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.
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?
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.
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
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
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.
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.
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.
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.
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.
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.
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).
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
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.
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!
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