Home > Archive > Visual Basic > February 2005 > Active X Control creation question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Active X Control creation question
|
|
| Mike Larson 2005-02-28, 8:55 pm |
| Hello,
I want to create a control that has a transparent background but display a
picture like an image control. Is there a way to set the basic UserControl
object to be transparent while displaying the picture?
Thanks.
Mike
| |
| Mike Larson 2005-02-28, 8:55 pm |
| Second question:
Why is it that a plain, blank UserControl that has a BackStyle property set
to Transparent show up transparent on a form but when the same control has a
Picture put into it the entire controls BackStyle is overidden to Opaque?
If that didn't happen my life would be easy.
Thanks.
Mike
"Mike Larson" <MikeTheRed@Hotmail.com> wrote in message
news:eLxVW2cHFHA.2784@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I want to create a control that has a transparent background but display a
> picture like an image control. Is there a way to set the basic
UserControl
> object to be transparent while displaying the picture?
>
> Thanks.
>
> Mike
>
>
| |
| Mike Larson 2005-02-28, 8:55 pm |
| OK, I'm not quite describing what is happening correctly, I just know it's
not doing what I want it to do.
Here are the thing I have tried.
1) empty UserControl, BackStyle set to Transparent. Result, BackColor of
form the UserControl is put onto shows through.
2) empty UserControl, BackStyle set to Transparent, picture put into Picture
property of UserControl. Result, UserControl still transparent, but picture
doesn't show up.
3) Image control placed onto UserControl, UserControl.BackColor =
Transparent. Picture placed into ImageControl is a .GIF file with
transparent portions. Result, most of UserControl is transparent on the
Form, but the transparent portions of the GIF picture are not transparent,
they show the UserControls opaque BackColor. However, if an image control
is placed on the form (not the usercontrol) and the same GIF picture is
placed in that the transparent portions are transparent.
Does anyone have an explanation for number 3.
Thanks for any info.
Mike
"Mike Larson" <MikeTheRed@Hotmail.com> wrote in message
news:eLxVW2cHFHA.2784@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I want to create a control that has a transparent background but display a
> picture like an image control. Is there a way to set the basic
UserControl
> object to be transparent while displaying the picture?
>
> Thanks.
>
> Mike
>
>
| |
| Ken Halter 2005-02-28, 8:55 pm |
| "Mike Larson" <MikeTheRed@Hotmail.com> wrote in message
news:%23asR7SdHFHA.2744@tk2msftngp13.phx.gbl...
> OK, I'm not quite describing what is happening correctly, I just know it's
> not doing what I want it to do.
>
There's probably something here (below) you can use to get rid of the
confusion.... I've only played with transparent stuff so all I can say
is.... I think it's all in the mask settings... anyway. Look here.
Searched PlanetSourceCode.com for "transparent usercontrol"
http://www.planetsourcecode.com/vb/...ontrol&lngWId=1
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
| |
| Mike Larson 2005-02-28, 8:55 pm |
| Thanks, Ken.
Through that example I was able to figure it out.
I set the MaskColor the same as the BackColor as a default. In my routine
to change the picture shown on the control (one of multiple pictures) the
algorithm goes as follows
1) Usercontrol.backstyle = 1 'Non transparent, UserControl.backcolor shows
through the transparent portions of the GIF picture I want to show.
2) Usercontrol.picture = MyPicture 'show the GIF picture I want to show,
the UserControl.backcolor shows through.
3) UserControl.maskpicture = UserControl.image 'The MaskPicture is set to
the image of the usercontrol, which is the Picture I want to show plus the
portion of the the UserControl that show through
4) UserControl.backstyle = 0 'transparent. Now anything that has the same
color as the UserControl.BackColor is now transparent. The only thing that
has the same color as the UserControl.BackColor is the tranparent portions
of the GIF picture I wanted to show.
Because the pictures I want to use already have transparent portions this
makes it eaiser for my, in my particular case.
Thanks.
Mike
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:%23ibtMcdHFHA.2984@TK2MSFTNGP15.phx.gbl...
> "Mike Larson" <MikeTheRed@Hotmail.com> wrote in message
> news:%23asR7SdHFHA.2744@tk2msftngp13.phx.gbl...
it's[color=darkred]
>
> There's probably something here (below) you can use to get rid of the
> confusion.... I've only played with transparent stuff so all I can say
> is.... I think it's all in the mask settings... anyway. Look here.
>
> Searched PlanetSourceCode.com for "transparent usercontrol"
>
http://www.planetsourcecode.com/vb/...ontrol&lngWId=1
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> Please keep all discussions in the groups..
>
>
|
|
|
|
|