Home > Net >  Winform user control problem
Winform user control problem

Time:09-21

For example, I want to design a button, including a PictureBox and a Label, as follows:


Want to realize the function of the is:
When I was in the use of the user control, can modify the picture and style,
That is to say, in the right properties, can choose a picture, can modify the text of the display,


User controls can I do now, but no way to modify the display images and text, as well as the font size, etc.,

CodePudding user response:

Assign custom controls in the control a Name like that PIC and lab
After using custom controls set a Name such as call button
Use the button in the background. The PIC and button. Lab can directly manipulate custom internal controls

CodePudding user response:

Simply put the object Public out let users to use the code to assign a value to modify

But I see you mean is to want to let the user on the designer modify

This designer attributes. I don't is changshu.

But temporary solution is that you put this picture button object exposed to the user to go
The user can write code assignment up

Like the designer design before

Now like to use the code to layout it...

So habit is to use code incoming parameters such as means to complete.

CodePudding user response:

reference 1st floor OrdinaryCoder response:
assign custom controls in the control a Name like that PIC and lab
After using custom controls set a Name such as call button
Use the button in the background. The PIC and button. Lab can directly manipulate custom internal controls

That is to say, when I was in the main interface to initialize, need inside the code dynamically to the user controls the assignment?
It should be ok, but I still have a trouble, can directly inside the attribute set?

CodePudding user response:

reference 3/f test code farmer born reply:
Quote: refer to 1st floor OrdinaryCoder response:

Assign custom controls in the control a Name like that PIC and lab
After using custom controls set a Name such as call button
Use the button in the background. The PIC and button. Lab can directly manipulate custom internal controls

That is to say, when I was in the main interface to initialize, need inside the code dynamically to the user controls the assignment?
It should be ok, but I still have a trouble, can directly inside the attribute set?

Directly in the attribute assignment never get,,,,,,,, I am only one way to think of it

CodePudding user response:

Baidu Winform custom dependency property should have direct assignment can be found in the property, just tried it on WPF can

CodePudding user response:

reference 5 floor OrdinaryCoder reply:
baidu Winform custom dependency property should have direct assignment can be found in the property, just tried it on WPF can

Emmmmmmmm checked the Winform dependency property didn't find,,,,,,,,,,,

CodePudding user response:

reference 4 floor OrdinaryCoder response:
Quote: refer to fifth floor OrdinaryCoder response:

Baidu Winform custom dependency property should have direct assignment can be found in the property, just tried it on WPF can

Emmmmmmmm checked the Winform dependency property didn't find,,,,,,,,,,,

Depend on the properties is unique, MVVM framework Winform

CodePudding user response:

Replace the pictures inside the mousemove mousedown mouseleave event, then the invalidated once, again in the event of an paint pictures you want painted is ok,

CodePudding user response:

This have what difficulty custom two attributes, getset return and set properties of picturebox image, as well as the font properties of lable, if you can draw, simply don't have to consider the combination control this way,
  • Related