Zero-sized form

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.
 
N

Nick Hounsome

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)
 
M

Mike Scott

Hi Nick

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

Cheers,

Mike.
 
N

Nick Hounsome

Oops - missed that.

Then do the old hack of just placing it off screen - that definitely works.
 
B

Brian P. Hammer

Mike - Is it possible to display the form off the screen? Maybe at
(-150, -150)

Brian
 
C

Chris Dunaway

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.
 
H

Herfried K. Wagner [MVP]

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.
 
N

Nick Hounsome

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top