Create a handle to control

I am currently creating a silent print module. The current control I'm using is that it is already created ( IsHandleCreated ). I did everything to deceive this without any luck.

Do you have any ideas on how to create a handle to the control without being displayed on the screen?

+6
c # controls handle
source share
5 answers

Try overriding the getter CreateParams property. In it, clear the WS_VISIBLE flag.

+4
source share

You need to access the Pen property (put the result in a dummy variable or something like that). Take a look at Reflector; it creates a descriptor creation.

+19
source share

I had the same problem with some other controls and the Control.CreateControl() method was used:

 private void CheckForExistingHandle(Control control) { if (!control.IsHandleCreated) control.CreateControl(); } 

But I do not know how this works with the print module. A.

+2
source share

I solved this annoying handwriting creation problem by setting WS_VISIBLE of CreationParams. You can either override the CreationParams Control property or call the CreateHandle method with the corresponding CreateParams instance. See Link

0
source share

Calling the private CreateHandle method will do the job.

 MethodInfo ch = frm.GetType().GetMethod("CreateHandle", BindingFlags.NonPublic | BindingFlags.Instance); ch.Invoke(frm, new object[0]); 
0
source share

All Articles