Hi,
I have a UserControl that inherits from the Label Control. I surpress any
drawing it normally does and draw my own Label by overriding the OnPaint.
The objective with my Label is to embed a TextBox as well, so, it'd be a
Label + TextBox in one. (Instead of having to use a Label and TextBox
seperately, it's, of course, also completely different looking than normal).
I cannot seem to get this done. It displays my self-drawn Label just fine,
including text but the TextBox i defined by "private TextBox EditBox = new
TextBox();" in the code (or dropped in the Component screen, no difference)
is nowhere to be found. I tried a "EditBox.Show();" after painting the
Label. Tried BringToFront() on it, Update(), Refresh, etc .. but the TextBox
is not showing up at all on top of the Label.
Any ideas? I'd hate to have to code an entirely custom TextBox from scratch
:)
Thanks,
Pure
Kevin Spencer - 16 Sep 2006 16:12 GMT
Create a new UserControl by inheriting System.Windows.Forms.UserControl. Add
a TextBox and Label to the Control. Expose the properties of the TextBox and
Label Controls as properties of the UserControl. No need to override OnPaint
or anything else.

Signature
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
What You Seek Is What You Get.
> Hi,
>
[quoted text clipped - 19 lines]
>
> Pure
Özden Irmak - 16 Sep 2006 19:19 GMT
Hello Pure,
Just add your textbox to "Controls" collection of your derived "Label"
control in a proper place such as in it's constructer, that's all...
Regards,
Özden
> Hi,
>
[quoted text clipped - 19 lines]
>
> Pure
PureCode - 17 Sep 2006 20:37 GMT
Thanks Guys :)
It turned out to be pretty simple indeed.. but as usual i forgot to add
something in my code (i tend to forget to add things like Designers to
controls and then wonder for hours why the heck things aren't working)..
but, ala.. one learns every day and C# has me learning HARD, it's easy to
develop a decent application in C# but once you start going in-depth with
it, man, it starts causing headaches.
Pure
> Hello Pure,
>
[quoted text clipped - 29 lines]
>>
>> Pure