LineTo, MoveToEx on iPAQ throws MissingMethodException

J

Joachim Fuchs

Hi,

I tried to use OpennetCF's GraphicsEx.DrawLine, but it didn't run on an
iPAQ. DrawLine uses the simple GDI-Functions LineTo and MoveToEx. They are
defined in Opennetcf.Drawing.GDIPlus.cs like this:

[DllImport("Coredll.dll")]
public static extern int LineTo(
IntPtr hdc,
int nXEnd,
int nYEnd);

[DllImport("Coredll.dll")]
public static extern bool MoveToEx(
IntPtr hdc,
int X,
int Y,
ref POINT lpPoint);

While they work fine on the Emulator and a Toshiba PDA, I get a
MissingMethodException an the iPAQ device. I can't believe, that these
methods are not implemented on the iPAQ since I can draw lines using the
standard Graphics.DrawLine Method.

What's wrong with LineTo and MoveToEx?

Thanks,
Joachim
 
P

Peter Foot [MVP]

Looking at the Pocket PC SDK documentation, it appears these two functions
were introduced in CE 4.0 so will not work on iPaq devices prior to Pocket
PC 2003.

Peter
 
J

Joachim Fuchs

Hi Peter,
Looking at the Pocket PC SDK documentation, it appears these two functions
were introduced in CE 4.0 so will not work on iPaq devices prior to Pocket
PC 2003.

thanks for finding the reason. What is the alternative? I'm using "Polygon"
now, but I can't believe that this is a usual way to draw a single line.
Which Methods are used when calling Graphics.DrawLine?

Why is LineTo and MoveToEx new in CE 4.0? It is Part of the GDI-API since
Win16.

Thanks
Joachim
 
J

Joachim Fuchs

Hi João Paulo,

thanks for your response.

O.K., I'll do it this way. But it's somehow funny, that a more complex
function like PolyLine was implemented before a basic function like LineTo.

Thanks
Joachim
 
A

Alex Feinman [MVP]

If you think of it, MoveTo/LineTo combination can always be replaced with
PolyLine. MoveTo/LneTo offers no tangible advantages over PolyLine. Early
video driver architecture (Presentation Manager) used LineTo and MoveTo as
basic GDI operations implemented on the driver level. Desktop Windows
carries a legacy with it. The CE video drivers did not need this API-level
compatibility and so they wen directly for PolyLine. Win32 API followed it.
Later these functions were apparently reintroduced for a reason unknown to
me.
 

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