Note that at the time of writing Visual Studio Designer support for .NET Core is not mature yet. There are some workarounds and a preview of the .NET Core Windows Forms Designer. Also, you have the option to manually edit the relevant files. The following documentation is explained using Visual Studio and .NET Framework, the same application functionality is possible in .NET Core.
Depending on which graphical subsystem a project is based on, a specific window control is available in Visual Studio's toolbox.
See section “Using Other GUI Libraries” for information about other GUI libraries.
The smart window control provides several advantages over HWindowControl:
In contrast to HSmartWindowControlWPF, a callback is required for HSmartWindowControl in order to enable zooming using the mouse wheel:
private void WindowControl_Load(object sender, EventArgs e)
{
this.MouseWheel += my_MouseWheel;
}
In addition, you need to transform the mouse coordinates, so that they are relative to the upper left corner of the HSmartWindowControl.
private void my_MouseWheel(object sender, MouseEventArgs e)
{
Point pt = WindowControl.Location;
MouseEventArgs newe = new MouseEventArgs(e.Button, e.Clicks,
e.X - pt.X, e.Y - pt.Y, e.Delta);
WindowControl.HSmartWindowControl_MouseWheel(sender, newe);
}
Using the smart window control, the following events are triggered and can be reacted to:
Not all operators can be used with the smart window control. The following operators are not supported:
Instead, use drawing objects.
In the following sections, the term HSmartWindowControl will be used for simplicity. Read it as HSmartWindowControlWPF if your project is based on WPF. The same applies to the older HWindowControl correspondingly.