Re: How to transparent TextBox in C#?

N

Nick

Is it not possible to set the background color of the Textbox to
transparent? I have seen this before, but I don't work in WinForms all that
much so I can't give you any exact code. But select the Textbox in VS.Net
and look on the side under the colors and there should be a color marked
transparent.
 
M

Marco Martin

Diwakar,
I've had to do this but with a panel. I just created a class that inherited
Panel, and override onPaintBackground() method.

private class TransparentPanel : Panel

{

public TransparentPanel()

{

}

//This method makes sure that the background is what is directly behind the
control

//and not what is behind the form...

override protected CreateParams CreateParams

{

get

{

CreateParams cp = base.CreateParams;

cp.ExStyle |= 0x20;

return cp;

}

}

override protected void OnPaintBackground(PaintEventArgs e)

{

// do nothing

}

}



hope this helps



regards,

Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top