Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Image Control and GDI+
Message
De
08/07/2003 12:13:23
Todd Cottengim
Alpine Land Information Services
Redding, Californie, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Titre:
Image Control and GDI+
Divers
Thread ID:
00808060
Message ID:
00808060
Vues:
40
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform