Click here to Skip to main content
15,888,148 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hello,

I have been using VSPrinter in VB6 for years but I have run into a problem that seems solvable but I can not solve. VSPrinter is an ActiveX printer object. I product engineering graphs using it and display the graph to the user using the Preview mode. One function of a graph is to define an irregular shape on the graph and fill it with a color. This is quite easy with VSPrinter. Now I want to test a list of coordinates to see if they are within the filled area, functionality not exposed by VSPrinter. Since the area could be any shape it seems the easiest approach would be to simply check if the pixel that corresponds to the coordinates is the fill color.

VSPrinter exposes a property that returns the hDC. So it would seem that this should be an easy call to the GDI GetPixel function with the hDC and coordinates but in all my attempts GetPixel always returns -1. The manufacturer of VSPrinter provides sample code that use a different GDI function to draw a rectangle within a VSPrinter preview window and there is a simple VB6 application that uses GetPixel to interact with a VB6 Picturebox here: http://www.vbforums.com/showthread.php?t=231161[^]

It looks like all the pieces are available but I can't seem to put it together.

Any help would be appreciated.

Thanks,
Jim
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900