Zero-sized form

  • Thread starter Thread starter Mike Scott
  • Start date Start date
M

Mike Scott

I'm using the Microsoft MapPoint ActiveX for routing and don't need a
GUI. Unfortunately, the developers of MapPoint didn't see fit to
partition the logic from the GUI, so I have to use the MapPoint ActiveX
control for routing, and it throws exceptions if it's not hosted in a
visible form.

The solution would appear simple: create a zero-sized form with no
border and host the control in that.

However, when I attempt to create a zero-sized (or even small, e.g.
10x10 pixel) form, it's always created with a size of (123,34) - i.e.
the Size property reverts to these values when I show the form.

S how can I force the form to stop overriding my requested size and
allow it to be zero-sized?

TIA

MikeS.
 
Mike Scott said:
I'm using the Microsoft MapPoint ActiveX for routing and don't need a GUI.
Unfortunately, the developers of MapPoint didn't see fit to partition the
logic from the GUI, so I have to use the MapPoint ActiveX control for
routing, and it throws exceptions if it's not hosted in a visible form.

The solution would appear simple: create a zero-sized form with no border
and host the control in that.

However, when I attempt to create a zero-sized (or even small, e.g. 10x10
pixel) form, it's always created with a size of (123,34) - i.e. the Size
property reverts to these values when I show the form.

S how can I force the form to stop overriding my requested size and allow
it to be zero-sized?

Have you suppressed the border? (FormBorderStyle)
 
Hi Nick

Yes - "The solution would appear simple: create a zero-sized form with
no border"

Cheers,

Mike.
 
Oops - missed that.

Then do the old hack of just placing it off screen - that definitely works.
 
Mike - Is it possible to display the form off the screen? Maybe at
(-150, -150)

Brian
 
And just to add to what the others said, you could make the form
totally transparent by setting it's Transparency property? That would
only work on W2K,and later, though.

You could also set the transparencyKey to a color, make the form
borderless and set the form's background color to that so that it is
totally transparent.
 
Mike Scott said:
The solution would appear simple: create a zero-sized form with no border
and host the control in that.

However, when I attempt to create a zero-sized (or even small, e.g. 10x10
pixel) form, it's always created with a size of (123,34) - i.e. the Size
property reverts to these values when I show the form.

This is a known problem.
S how can I force the form to stop overriding my requested size and allow
it to be zero-sized?

Try setting the form's size to 'New Size(0, 0)' in its 'Load' event handler.
 
Herfried K. Wagner said:
This is a known problem.


Try setting the form's size to 'New Size(0, 0)' in its 'Load' event
handler.

It doesn't work.0 is not allowed - it comes out about 10x10.
1x1 does work. Off screen is better though.
 
Back
Top