Home > Net >  Custom control problem of attributes to the panel? As shown in figure
Custom control problem of attributes to the panel? As shown in figure

Time:09-20


I define a Rectangle type of attribute, why in the properties panel is read-only (wrote a set)? And unlike the attributes can be expanded as below, how to make it the X, Y, Width, height can be expanded?

CodePudding user response:

How do you define, the code to see

CodePudding user response:

reference 1st floor Bridge_go response:
how do you define the code to see


A Rectangle textRect=new Rectangle (0,0,100,100);
Public Rectangle _TextRect {
The get {return this. TextTect; }
The set {enclosing textText=value; }
}

CodePudding user response:

Hand knock, or copy, enclosing textTect, enclosing textText, textRect not correspond

CodePudding user response:

reference 1st floor Bridge_go response:
how do you define the code to see

Not know, I use RectangleF type, can use a Rectangle type, but why can't use a custom class begin?
 
Public class AA
{
Public string a {get; set; }
Public string b {get; set; }
}
AA AA=new AA {="2", b="3"};
Public AA _rect {get {return this. AA; } the set {this. Aa=value; Enclosing Invalidate (); }}

CodePudding user response:

reference Bridge_go reply: 3/f
hand knock, or copy, enclosing textTect, enclosing textText, textRect don't correspond to the

Please look at the example on me, so why not in class? Properties panel in this property is still a grey read-only, why

CodePudding user response:

Add [TypeConverter to AA (typeof (ExpandableObjectConverter)]

CodePudding user response:

refer to 6th floor Bridge_go response:
to AA plus [TypeConverter (typeof (ExpandableObjectConverter)]

Out, but it shows that this is not very good, can be customized into a=1, b=2 this form?

CodePudding user response:

Help you find the link, according to this change
https://blog.csdn.net/zlvol1985/article/details/73456938
  •  Tags:  
  • C#
  • Related