Re: (HW) Adding custom controls within a project
From: Helmut Wagensonner (helmut.wagensonner_at_gmx.net)
Date: 02/13/05
- Next message: clu: "Re: Async Question"
- Previous message: Frans Bouma [C# MVP]: "Re: Passing in SqlConnection by ref"
- In reply to: Mick Doherty: "Re: (HW) Adding custom controls within a project"
- Next in thread: Sean Hederman: "Re: (HW) Adding custom controls within a project"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 13 Feb 2005 12:16:46 +0100
Thanks a lot! I will try immediately. I remember, that the guy in the
presentation used a different way - but anyway...
Thx, Helmut
"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> schrieb
im Newsbeitrag news:ehetcPUEFHA.228@tk2msftngp13.phx.gbl...
> The common way
> Right Click the Toolbox and select "Add/Remove Items..."
> Browse to your projects Bin directory and select the exe.
> Click the OK button and the control will be added to the toolbox.
> This will be on the toolbox of every project you now open.
>
> The way I do it
> Comment out the code for your control.
> Change Inheritance from TextBox to UserControl.
> Show the controls designer and rebuild the project.
> The textbox control is now in your "My User Controls" tab.
> Reset inheritance back to TextBox, uncomment the code and rebuild.
> This will only be on the toolbox for your current project.
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> "Helmut Wagensonner" <helmut.wagensonner@gmx.net> wrote in message
> news:eQHhTLTEFHA.3732@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> I have created a custom textBox within a C# project. I want to put that
>> custom textBox on a form now. I heard about a way, to place that user
>> control onto a form within the same project, without having to compile
>> it seperately before.
>>
>> An example:
>>
>> 1. In Visual Studio create a new C# Windows Application
>> 2. Add a User Control to the Project
>> 3. Modify the code of the control so that it inherits from
>> System.Windows.Forms.TextBox
>> 4. Overwrite some function (i. e. OnDragEnter)
>>
>> protected override void OnDragEnter(DragEventArgs drgevent)
>> {
>> MessageBox.Show("Test");
>> base.OnDragEnter (drgevent);
>> }
>>
>> 5. ...and this is where I stuck: Add this modified textBox to the
>> existing Form1
>>
>> It's not possible, to simply drag it on the Form (in Design View), like
>> you do with controls from the Toolbox. I know, that there's a way. I saw
>> this a couple of months before in some presentation, but cannot remember
>> how the guy did this.
>>
>> Anybody out there knows?
>>
>
>
- Next message: clu: "Re: Async Question"
- Previous message: Frans Bouma [C# MVP]: "Re: Passing in SqlConnection by ref"
- In reply to: Mick Doherty: "Re: (HW) Adding custom controls within a project"
- Next in thread: Sean Hederman: "Re: (HW) Adding custom controls within a project"
- Messages sorted by: [ date ] [ thread ]