Force Paint refresh on control

NachitoMax 411 Reputation points
2021-03-11T15:26:46.82+00:00

Hey

I am populating a picturebox with a view from an application. The picturebox isnt exactly showing an image, rather it is showing a visual view of a window. The 3rd party application requires a display object to hook into a uses its hwnd like this

oClientView = oAppDoc.ClientViews.Add(PictureBox1.Handle.ToInt32())

This is ok and displays as expected but, only displays once i have moved my mouse over it. Id like to try and force a paint event to do this as it loads but cannot really find anything useful.

How can i force a paint event to trigger in order to display the view?

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,374 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 81,726 Reputation points
    2021-03-11T15:31:09.1+00:00

    The standard ways to force a repaint are
    Control.Invalidate
    or
    Control.Refresh