c# - Map Property to User Control -


i have usercontrol , have added property it. want property added properties window whenever usercontrol added form.

this used add property

image img; public image setimage  {     { return img; }     set { img = value; } } 

this works fine problem whenever user wants call property, user have call class of user control like

mycontrol ctrl = new mycontrol(); ctrl.image = image.fromfile("/*path image*/"); 

but change property controls have been added form need map usercontrol whenever user want call it, user call like

mycontrol1.image = image.fromfile("/*path image*/"); 

or

mycontrol2.image = image.fromfile("/*path image*/"); 

pls how acheive this?

add [browsable(true)] tag (which in system.componentmodelnamespace inside system.dll) desired property of user control class:

public class yourusercontrol {     ....     ....     [browsable(true)]     public image setimage      {         { return img; }         set { img = value; }     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -