Using a form purely programatically - by proxy.

  • Thread starter Thread starter Simon Tamman {Uchiha Jax}
  • Start date Start date
S

Simon Tamman {Uchiha Jax}

Scenario:

Two System.Windows.Forms: Form1 and Form2.
Form1 is displayed, Form2 is hidden.

At this juncture, is it possible to take the graphics from Form2 and output
that to Form1's display and take all of the mouse and key events from Form1
and pass those on to Form2, thus changing the graphical output on Form2 and
then pasting those graphical changes back to Form1?
Is this some kind of P/Invoke job?

Regards

Jax
 
Jax,

You can design this much better so that it is an easier operation.
Simply, have the contents of forms one and two contained in controls,
instead of forms, and then host both controls on the same form. Then, you
don't have to worry about all of the input switching and whatnot.

Also, one might ask, why not just hide form one and then show form two?

Hope this helps.
 
I don't want the user of the program to directly see the windows controls, I
want to be able to capture the graphics of the controls of the hidden form,
and overlay those graphics on Form1 (on top of another bunch of stuff i'm
drawing).
Then translate the clicks on Form1 to Form2 so that the controls are
properly updated when the graphics are next captured from Form2 and
displayed on Form1.

This is essentially a simple hack of the GUI so I can implement dynamic
graphic arrangement and not have to worry about transparency issues or
implementing WinForm control functionality.
Does this make much sense to you?

Regs

Jax


Nicholas Paldino said:
Jax,

You can design this much better so that it is an easier operation.
Simply, have the contents of forms one and two contained in controls,
instead of forms, and then host both controls on the same form. Then, you
don't have to worry about all of the input switching and whatnot.

Also, one might ask, why not just hide form one and then show form two?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Scenario:

Two System.Windows.Forms: Form1 and Form2.
Form1 is displayed, Form2 is hidden.

At this juncture, is it possible to take the graphics from Form2 and
output
that to Form1's display and take all of the mouse and key events from
Form1
and pass those on to Form2, thus changing the graphical output on Form2
and
then pasting those graphical changes back to Form1?
Is this some kind of P/Invoke job?

Regards

Jax
 
Simon,

Yes, it does, but I don't understand for the life of me WHY you would do
this, when you can just either show the original form, or create separate
controls. You are passing everything through to the form, as well as
displaying the form anyways.

If you REALLY want to do this, I really don't think that there is a good
way to do this.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
I don't want the user of the program to directly see the windows controls,
I
want to be able to capture the graphics of the controls of the hidden
form,
and overlay those graphics on Form1 (on top of another bunch of stuff i'm
drawing).
Then translate the clicks on Form1 to Form2 so that the controls are
properly updated when the graphics are next captured from Form2 and
displayed on Form1.

This is essentially a simple hack of the GUI so I can implement dynamic
graphic arrangement and not have to worry about transparency issues or
implementing WinForm control functionality.
Does this make much sense to you?

Regs

Jax


in
message news:[email protected]...
Jax,

You can design this much better so that it is an easier operation.
Simply, have the contents of forms one and two contained in controls,
instead of forms, and then host both controls on the same form. Then,
you
don't have to worry about all of the input switching and whatnot.

Also, one might ask, why not just hide form one and then show form two?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Scenario:

Two System.Windows.Forms: Form1 and Form2.
Form1 is displayed, Form2 is hidden.

At this juncture, is it possible to take the graphics from Form2 and
output
that to Form1's display and take all of the mouse and key events from
Form1
and pass those on to Form2, thus changing the graphical output on Form2
and
then pasting those graphical changes back to Form1?
Is this some kind of P/Invoke job?

Regards

Jax
 
The purpose was a dynamic UI where the UI would be created via an image and
a mapping file (a black and white image specifying where the controls are,
for click events).
As this isn't a main element of the project i'm not prepared to build a
dynamic UI from the ground up as I don't want to re-invent the wheel (like a
textbox, button, listbox etc) as it will take too long.
This is the reason why the idea is odd, it's a simple hack.

So the idea was to get the graphics of the WinForm controls from elsewhere,
gather that up in a bitmap, paste the image (save the transparent coloured
parts) on top, then output to the display of the visible Form.
To to get around the issue of the click events, You could then specify
what is and what isn't a click by choosing to pass the click through only
when the click point matches that of a "white" pixel in the mapping file.
If that click could then update the "hidden" form (like, the selection of an
item in the listbox) and you could capture the graphics again and update the
selection to the UI. (Whoop!)

This would be a nice hack but I don't think it will be possible.
As our accesss to the WinForm GDI is very much a Control-Up system rather
than a Top-Down form of control it's a long job to implement this the
correct way.

I'm thinking that the best i'm going to get is creating customised controls
(for each control) to support transparency and using something like MyXAML
to enable the dynamic support.

Thanks for your help though and your time considering this concept.

Kind Regards
Jax

It's a suggestion
Nicholas Paldino said:
Simon,

Yes, it does, but I don't understand for the life of me WHY you would do
this, when you can just either show the original form, or create separate
controls. You are passing everything through to the form, as well as
displaying the form anyways.

If you REALLY want to do this, I really don't think that there is a good
way to do this.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
I don't want the user of the program to directly see the windows controls,
I
want to be able to capture the graphics of the controls of the hidden
form,
and overlay those graphics on Form1 (on top of another bunch of stuff i'm
drawing).
Then translate the clicks on Form1 to Form2 so that the controls are
properly updated when the graphics are next captured from Form2 and
displayed on Form1.

This is essentially a simple hack of the GUI so I can implement dynamic
graphic arrangement and not have to worry about transparency issues or
implementing WinForm control functionality.
Does this make much sense to you?

Regs

Jax


in
message news:[email protected]...
Jax,

You can design this much better so that it is an easier operation.
Simply, have the contents of forms one and two contained in controls,
instead of forms, and then host both controls on the same form. Then,
you
don't have to worry about all of the input switching and whatnot.

Also, one might ask, why not just hide form one and then show form two?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

"Simon Tamman {Uchiha Jax}"
Scenario:

Two System.Windows.Forms: Form1 and Form2.
Form1 is displayed, Form2 is hidden.

At this juncture, is it possible to take the graphics from Form2 and
output
that to Form1's display and take all of the mouse and key events from
Form1
and pass those on to Form2, thus changing the graphical output on Form2
and
then pasting those graphical changes back to Form1?
Is this some kind of P/Invoke job?

Regards

Jax
 
Back
Top