Using windows controls in shapes

Jul 15, 2014 at 10:20 AM
Hi

Did you ever try to use standard windows controls in NShape shapes?

For example, is it possible to create a shape with two text boxes (or combo boxes or any other standard windows control) where user could enter a value or select an item?


Thanks,
Zvonko
Coordinator
Jul 16, 2014 at 7:21 AM
Edited Jul 22, 2014 at 7:07 AM
Hi,

we have experimented with shapes containing WinForm controls, but these were really experimental shapes.
One of the biggest problem is the seamless integration with all the features of the framework:
Rotating, Exporting to EMF images, styling with NShape styles, etc.

It is possible but if you want to support the whole range of features, it will be a lot of work... íf you can dump some of the dificult features as you do not need them, it won't be that hard... just take the RectangleBase class and derive a WinFormsHost shape, overwrite the Draw method and play around a bit.
Jul 21, 2014 at 3:08 PM
It would be nice if Coordinator can provide an example,
such as how to derive from RectangleBase class, and use MsChart control or use custom Gauge control.
because these two type controls is important for SCADA system.
Thanks a lot.
Coordinator
Jul 22, 2014 at 7:20 AM
Edited Jul 22, 2014 at 7:20 AM
It would be nice if Coordinator can provide an example,
such as how to derive from RectangleBase class,
See documentation: "Programmer Tasks > Developing a New Shape Class".
If you have more specific questions or problems, feel free to ask.
and use MsChart control or use custom Gauge control.
because these two type controls is important for SCADA system.
As I said before:
NShape does not support WinForms controls as part of shapes or even as shape replacement out of the box.
You can try to implement such shapes but be warned: When trying to support the full shape feature set, this will be not an easy task.
I'm sorry, but we do not have example code - the mentioned experimental code does no longer exist as it was written for a very early alpha version of NShape and would not be compatible to the current version anyway.