-
5 Attachment(s)
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.
-
Re: Simple Transparent Frame User Control
-
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.
-
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,
-
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
-
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
-
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
-
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.
-
1 Attachment(s)
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.
-
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.
-
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,
-
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?
-
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.
-
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.
-
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.
-
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!
-
Re: Simple Transparent Frame User Control
Quote:
Originally Posted by
broc028
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
-
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.
-
Re: Simple Transparent Frame User Control
Quote:
Originally Posted by
Edgemeal
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. :confused:
Can you pls upload a copy of what you did for others 2 share
-
1 Attachment(s)
Re: Simple Transparent Frame User Control v1.08
Quote:
Originally Posted by
Edgemeal
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
-
Re: Simple Transparent Frame User Control
Quote:
Originally Posted by
Edgemeal
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. :confused:
Can you please place or upload a copy of what you did so i could see it. you said you got it to work.
-
Re: Simple Transparent Frame User Control v1.08
Quote:
Originally Posted by
coolcurrent4u
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.
-
Re: Simple Transparent Frame User Control
Quote:
Originally Posted by
coolcurrent4u
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!
-
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
-
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.
-
Re: Simple Transparent Frame User Control v1.09
the control is not a container
how do i make it one?
-
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.
-
Re: Simple Transparent Frame User Control v1.09
if i can't place controls on it, then its of no use.
-
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.
-
Re: Simple Transparent Frame User Control v1.09
Quote:
Originally Posted by
Edgemeal
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
-
Re: Simple Transparent Frame User Control v1.09
Quote:
Originally Posted by
coolcurrent4u
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.
-
1 Attachment(s)
Re: Simple Transparent Frame User Control v1.09
ok here is a sample project
pls chk it out
-
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).
-
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
-
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.
-
1 Attachment(s)
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!
-
Re: Simple Transparent Frame User Control v1.09
can you send me this project to play with
-
Re: Simple Transparent Frame User Control v1.09
Quote:
Originally Posted by
coolcurrent4u
can you send me this project to play with
Have fun playing. :)
-
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
-
Re: Simple Transparent Frame User Control v1.09
Quote:
Originally Posted by
coolcurrent4u
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....
.