transparent textboxes - quick question

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

    transparent textboxes - quick question

    Hi,
    I found this online:
    "If the SupportsTranspa rentBackColor bit is set to true, and the BackColor
    is set to a color whose alpha component is less than 255, OnPaintBackgrou nd
    will simulate transparency by asking its parent control to paint the
    background."

    What I've tried to do is this:
    On the main form declared private TbJob tbJob (this is the textbox), as well
    as set tbJob.Parent = pbEBS; (the picturebox I want as the background). Then
    there's:
    public class TbJob:TextBox
    {
    protected override void OnPaintBackgrou nd(PaintEventAr gs e)
    {
    this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int,true);
    this.SetStyle(C ontrolStyles.Do ubleBuffer,true );
    this.SetStyle(C ontrolStyles.Us erPaint,true);
    this.SetStyle(C ontrolStyles.Su pportsTranspare ntBackColor,tru e);
    this.BackColor = Color.FromArgb( 0,255,0,0);
    }
    }

    I've set all the things that the online help says to set, and I can't figure
    out what I'm missing.

    Thanks very much for any help!
    Melanie
  • J.Marsch

    #2
    Re: transparent textboxes - quick question

    Melanie:

    I'm afraid that I have bad news for you. The textbox control that you get
    with the .Net runtime does not support transparency -- even if you alter the
    create params to configure transparency. You're going to have find a
    third-party control that does.


    "melanieab" <melanieab@disc ussions.microso ft.com> wrote in message
    news:886118DA-FA4A-4871-8E8A-7E21B69C1D9E@mi crosoft.com...[color=blue]
    > Hi,
    > I found this online:
    > "If the SupportsTranspa rentBackColor bit is set to true, and the BackColor
    > is set to a color whose alpha component is less than 255,
    > OnPaintBackgrou nd
    > will simulate transparency by asking its parent control to paint the
    > background."
    >
    > What I've tried to do is this:
    > On the main form declared private TbJob tbJob (this is the textbox), as
    > well
    > as set tbJob.Parent = pbEBS; (the picturebox I want as the background).
    > Then
    > there's:
    > public class TbJob:TextBox
    > {
    > protected override void OnPaintBackgrou nd(PaintEventAr gs e)
    > {
    > this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int,true);
    > this.SetStyle(C ontrolStyles.Do ubleBuffer,true );
    > this.SetStyle(C ontrolStyles.Us erPaint,true);
    > this.SetStyle(C ontrolStyles.Su pportsTranspare ntBackColor,tru e);
    > this.BackColor = Color.FromArgb( 0,255,0,0);
    > }
    > }
    >
    > I've set all the things that the online help says to set, and I can't
    > figure
    > out what I'm missing.
    >
    > Thanks very much for any help!
    > Melanie[/color]


    Comment

    Working...