Search code examples
c#winformswebformscustom-controlswinforms-to-web

Creating 1 Customer Control with Textbox and PictureBox


I want to create a custom control where a textbox will be over a picturebox. I have search but cant find the answer. I have encountered create your own button, dropbox, textbox, etc that will do specific action. I want to basically combine both controllers (textbox and picturebox with predefined attributes) into one. I am not sure if this can be done. I want this custom control to be in a library class where I can drag and drop from the toolbox into a winform or webform.


Solution

  • Add new Class library project to your solution :

    On Solution Explorer right click , select Add ,New Project . Select Class Library ,Click OK

    And add user control to this new Class library :

    On class library , right click and select Add, User control ,insert a name click OK

    Now drag textBox and picturebox on user control . Build your project.

    Now you can add your new user control from Toolbox to your form