Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Image Control and GDI+
Message
From
08/07/2003 12:13:23
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Image Control and GDI+
Miscellaneous
Thread ID:
00808060
Message ID:
00808060
Views:
39
I have a form with 30 - 50 image controls each displaying a transparent background GIF. The images themselves are irregular. The controls are overlapped, creating a mosaic effect, much like a puzzle with each image control containing one piece of the puzzle.

When the user clicks on the mosaic of images, he wants to know which piece has been clicked on.

Current code to determine which control has been clicked looks something like this...
LPARAMETER pnX, pnY
#DEFINE dnWhite RGB(255,255,255)
WITH thisform
  FOR EACH oCtrl IN .Controls
    IF "Vf_images" $ oCtrl.Class ;
	AND BETWEEN(pnX, oCtrl.Left, oCtrl.Left + oCtrl.Width) ;
	AND BETWEEN(pnY, oCtrl.Top, oCtrl.Top + oCtrl.Height)

      oImage.Load(oControl.Picture)

      IF oImage.GetPixelColor(pnX - oCtrl.Left, pnY - oCtrl.Top) # dnWhite
        ** Code here for desired piece
      ENDIF
    ENDIF
  ENDFOR
ENDWITH
The problem is the line oImage.Load(oControl.Picture). To process each image control until I get the desired one can take for 1 to 3 seconds depending on how far down the control list the image control is.

I saw a function in GDI+ called FromPicture(). It takes a picture object as a parameter and appears to replace the Load() function. The only problem is that when I try to use it and pass in the Image object, I get any error.

Any suggestions.

Thank you.
Next
Reply
Map
View

Click here to load this message in the networking platform