Starting from Eyeshot 2022 this solution is no longer needed if the Minimum Frame Rate is enabled.
In order to speed up the resizing of our control, it is possible to activate the culling feature even during its resizing. Here is the snippet code for both WinForms and WPF.
For WinForms:
protected override void OnResizeBegin(EventArgs e)
{
base.OnResizeBegin(e);
// speed up the resize of the control
model1.ResizeBegin();
}
For WPF:
public class MainWindow : Window
{
public MainWindow()
{
ResizeBegin += MainWindow_ResizeBegin;
}
public event EventHandler ResizeBegin;
void MainWindow_ResizeBegin(object sender, EventArgs e)
{
model1.ResizeBegin();
}
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
const int WM_ENTERSIZEMOVE = 0x0231;
if (msg == WM_ENTERSIZEMOVE)
{
if (ResizeBegin != null)
{
ResizeBegin(this, EventArgs.Empty);
}
}
return IntPtr.Zero;
}
protected override void OnContentRendered(EventArgs e)
{
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
source.AddHook(new HwndSourceHook(WndProc));
base.OnContentRendered(e);
}
}
Comments
Please sign in to leave a comment.