On 6 d=E9c, 16:19, Simon <Si...@discussions.microsoft.com> wrote:
> I suggest reading my code a little further. I don't think your understandi=
ng
> my question or I am misunderstanding your responses my apologies.
>
> I want transparent panels because I want other objects behind it to be
> visible. Don't be confused with a window being transparent. I do not want =
to
> see what is in behind the application.
>
> Panels paint their BackColor. So do many controls such as Label etc.
>
> If you look at my code, how it "hacks" a transparent panel is by hidding
> itself then invalidating its region on the Parent control thus rendering i=
t
> with the Panel "not visible" then it sets it back to visible.
>
> By doing this, if you have a PictureBox behind the Panel, the PictureBox
> shows through.
>
> This works great until you run into a situation where painting occurs more=
> frequent such as scrolling. Because if you have nested panels its essentia=
lly
> forcing each parent up the tree to repaint thus causing the children to
> repaint as well each time.
>
> This causes much flickering when scrolling because eventually it gets up t=
o
> the Form level.
>
> Take a look at the code. It is very smart code I am surprised it works
> however its not entirely efficient so anything that needs to repaint a few=
> times in a row such as when scrolling occurs it becomes very flickery.
>
> Thanks and take care.
>
>
>
> "Fabien" wrote:
> > Yes ok sorry I didn't understand what you needed. I think you can't
> > with a panel but you can create a Form and override the OnPaint method
> > of your Form and draw and fill the form you want. You will obtain 2
> > Forms but the second one will have transparent background.
>
> > Hope this help you
>
> > BR
>
> > Fabien Decret (Device Application Development MVP)
> > Windows Embedded Consultant
>
> > ADENEO (ADESET)
> >
http://www.adeneo.adetelgroup.com/|
http://fabdecret.blogspot.com/ >
> > On 4 d=E9c, 19:17, Simon <Si...@discussions.microsoft.com> wrote:
> > > I can't read that post however it looks like its just doing transparen=
t
> > > bitmaps?
>
> > > I am wanting a Panel to be transparent. So if a panel is ontop of a
> > > PictureBox any controls in the Panel won't render a big white rectangl=
e on
> > > the Panel.
>
> > > Thanks and take care.
>
> > > "Fabien" wrote:
> > > > Hi,
>
> > > > Check out this:
> > > >
http://fabdecret.blogspot.com/2007/11/transparent-background.html > > > > But, it is only available for one transparency colour !
>
> > > > BR
>
> > > > Fabien Decret (Device Application Development MVP)
> > > > Windows Embedded Consultant
>
> > > > ADENEO (ADESET)
> > > >
http://www.adeneo.adetelgroup.com/|
http://fabdecret.blogspot.com/ >
> > > > On Dec 4, 6:12 pm, Simon <Si...@discussions.microsoft.com> wrote:
> > > > > Hey gang.
>
> > > > > I am working on making a transparent panel control. How this contr=
ol works
> > > > > is making itself invisible then invalidating its parent.
>
> > > > > This works great until you get panels in panels & using auto scrol=
l on the
> > > > > Panel because the flickering that occurs when scrolling.
>
> > > > > I am thinking this is because its invalidating a parent which inva=
lidates
> > > > > its parent etc and I believe its probably getting up to invalidati=
ng the form
> > > > > level.
>
> > > > > I am trying to achieve Panels that are transparent so if there is =
a
> > > > > PictureBox behind them, it will show through.
>
> > > > > As follows:
>
> > > > > protected override void OnPaintBackground(PaintEventArgs e=
)
> > > > > {
> > > > > if (this.BackColor =3D=3D Color.Transparent)
> > > > > return;
>
> > > > > base.OnPaintBackground(e);
> > > > > }
>
> > > > > protected override void OnPaint(PaintEventArgs e)
> > > > > {
> > > > > if (this.BackColor =3D=3D Color.Transparent)
> > > > > {
> > > > > if (!isPaintBackgroundComplete)
> > > > > {
> > > > > this.Visible =3D false;
> > > > > this.Parent.Invalidate(Bounds);
> > > > > this.Parent.Update();
> > > > > this.Visible =3D true;
> > > > > isPaintBackgroundComplete =3D true;
>
> > > > > return;
> > > > > }
> > > > > isPaintBackgroundComplete =3D false;
> > > > > }
> > > > > }
>
> > > > > Is there a better way to achieve this? As mentioned this mostly fl=
ickers
> > > > > when scrolling because I think its invalidating 2-3-4 parents up t=
o the form
> > > > > level.
>
> > > > > Is there any PInvoke support that could help out here? I could not=
find
> > > > > anything on google. Everything I saw was for the full framework.
>
> > > > > I would appreciate any help.
>
> > > > > Thanks and take care.- Masquer le texte des messages pr=E9c=E9dent=
s -
>
> > > - Afficher le texte des messages pr=E9c=E9dents -- Masquer le texte de=
s messages pr=E9c=E9dents -
>
> - Afficher le texte des messages pr=E9c=E9dents -