transparent label over textbox

G

Guest

Hi,
I'd like to put a transparent label over a textbox. I set the label
backcolor to transparent, and set its parent as the textbox. But setting the
textbox as the parent resulted in the label not showing up at all (I changed
the backcolor to a color to see if it would show up). Anyone know what to do?
Thanks!!!
Mel
 
N

Nicholas Paldino [.NET/C# MVP]

Mel,

Instead of doing this, why not custom paint the textbox?
 
G

Guest

What I'm trying to do is:
I have the textbox, and it's set at read-only. But you can still have the
mouse enter and the cursor blink in it. I want it so that the user can't
enter the textbox at all without having to disable it (and change its color).
Also, I've tried replacing the textbox with a label, but the text color
isn't as vibrant as with a textbox (I'm being picky here). I was just hoping
you could set the transparent label's parent to anything, and it would work
just the same as when the parent is a picturebox. In the meantime now, I've
tried the same thing with a textbox (putting a transparent textbox over the
other textbox) and it reacts the same as the label.
Any way to get this textbox so that it's not enterable?
Thanks again!!!
Mel
 
F

Ferdinand Mitterbauer

melanieab said:
What I'm trying to do is:
I have the textbox, and it's set at read-only. But you can still have the
mouse enter and the cursor blink in it. I want it so that the user can't
enter the textbox at all without having to disable it (and change its color).

Maybe this will work for you?

Implement the "Enter"-Event of your TextBox:

private void textBox1_Enter(object sender, EventArgs e)
{
SelectNextControl(this, true, true, true, true);
}
 

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