Creating a truly transparent control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • melanieab

    #1

    Creating a truly transparent control

    Hi,
    I found this online:
    protected override CreateParams CreateParams
    {
    get
    {
    CreateParams cp = base.CreatePara ms;
    cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARE NT
    return cp;
    }
    }
    so I created a new class (called TransparentCont rol), put the above in it,
    then on my normal form I made the label private TransparentCont rol label7;
    and changed the appropriate line in InitializeCompo nent() this.label7 = new
    HCAUT.Transpare ntControl();. I also made the backcolor of the label
    Transparent. But when I run everything, the label's backcolor still isn't
    transparent. Does anyone know what I'm doing wrong?
    Thanks so much!
    Mel
  • Tim Wilson

    #2
    Re: Creating a truly transparent control

    Try the method outlined at the link below.

    --
    Tim Wilson
    ..NET Compact Framework MVP


    "melanieab" <melanieab@disc ussions.microso ft.com> wrote in message
    news:5F6D25FA-38F0-4A77-8365-14B2E0121B16@mi crosoft.com...[color=blue]
    > Hi,
    > I found this online:
    > protected override CreateParams CreateParams
    > {
    > get
    > {
    > CreateParams cp = base.CreatePara ms;
    > cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARE NT
    > return cp;
    > }
    > }
    > so I created a new class (called TransparentCont rol), put the above in it,
    > then on my normal form I made the label private TransparentCont rol label7;
    > and changed the appropriate line in InitializeCompo nent() this.label7 =[/color]
    new[color=blue]
    > HCAUT.Transpare ntControl();. I also made the backcolor of the label
    > Transparent. But when I run everything, the label's backcolor still isn't
    > transparent. Does anyone know what I'm doing wrong?
    > Thanks so much!
    > Mel[/color]


    Comment

    • Tim Wilson

      #3
      Re: Creating a truly transparent control

      Posted too soon. Here's the link.
      http://www.c-sharpcorner.com/Code/20...ntControls.asp

      --
      Tim Wilson
      ..NET Compact Framework MVP

      "Tim Wilson" <TIM(UNDERSCORE )WILSON(AT)ROGE RS(PERIOD)COM> wrote in message
      news:%23YopDJEK GHA.140@TK2MSFT NGP12.phx.gbl.. .[color=blue]
      > Try the method outlined at the link below.
      >
      > --
      > Tim Wilson
      > .NET Compact Framework MVP
      >
      >
      > "melanieab" <melanieab@disc ussions.microso ft.com> wrote in message
      > news:5F6D25FA-38F0-4A77-8365-14B2E0121B16@mi crosoft.com...[color=green]
      > > Hi,
      > > I found this online:
      > > protected override CreateParams CreateParams
      > > {
      > > get
      > > {
      > > CreateParams cp = base.CreatePara ms;
      > > cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARE NT
      > > return cp;
      > > }
      > > }
      > > so I created a new class (called TransparentCont rol), put the above in[/color][/color]
      it,[color=blue][color=green]
      > > then on my normal form I made the label private TransparentCont rol[/color][/color]
      label7;[color=blue][color=green]
      > > and changed the appropriate line in InitializeCompo nent() this.label7 =[/color]
      > new[color=green]
      > > HCAUT.Transpare ntControl();. I also made the backcolor of the label
      > > Transparent. But when I run everything, the label's backcolor still[/color][/color]
      isn't[color=blue][color=green]
      > > transparent. Does anyone know what I'm doing wrong?
      > > Thanks so much!
      > > Mel[/color]
      >
      >[/color]


      Comment

      Working...