Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining row/col pixel position of text cursor in con
Message
De
01/11/2001 13:03:49
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/11/2001 12:58:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00575285
Message ID:
00576288
Vues:
33
This message has been marked as a message which has helped to the initial question of the thread.
You're welcome.
For fun try this also and say check your flag's color values :)
_Screen.visible = .f.
oForm = createobject('MyForm')
oForm.Show
Read events
_Screen.visible = .t.

Define CLASS myForm AS form
  Top = 0
  Left = 0
  Height = 97
  Width = 233
  ShowWindow = 2
  DoCreate = .T.
  BorderStyle = 0
  Caption = "Mouse Pos and Color"
  posx = 0
  posy = 0
  pixelcolor = 0
  Name = "Form1"

  Add OBJECT lblxpos AS label WITH ;
    Caption = "XPos", ;
    Height = 17, ;
    Left = 13, ;
    Top = 15, ;
    Width = 31, ;
    Name = "lblXpos"

  Add OBJECT lblypos AS label WITH ;
    Caption = "Ypos", ;
    Height = 17, ;
    Left = 14, ;
    Top = 45, ;
    Width = 30, ;
    Name = "lblYpos"

  Add OBJECT lblcolor AS label WITH ;
    Caption = "Color", ;
    Height = 17, ;
    Left = 12, ;
    Top = 75, ;
    Width = 32, ;
    Name = "lblColor"

  Add OBJECT txtxpos AS textbox WITH ;
    FontBold = .T., ;
    ControlSource = "thisform.PosX", ;
    Height = 23, ;
    Left = 52, ;
    ReadOnly = .T., ;
    Top = 12, ;
    Width = 100, ;
    Name = "txtXpos"

  Add OBJECT txtypos AS textbox WITH ;
    FontBold = .T., ;
    ControlSource = "Thisform.PosY", ;
    Height = 23, ;
    Left = 52, ;
    ReadOnly = .T., ;
    Top = 42, ;
    Width = 100, ;
    Name = "txtYpos"

  Add OBJECT txtcolor AS textbox WITH ;
    FontBold = .T., ;
    ControlSource = "Thisform.PixelColor", ;
    Height = 23, ;
    Left = 52, ;
    ReadOnly = .T., ;
    Top = 72, ;
    Width = 100, ;
    Name = "txtColor"

  Add OBJECT timer1 AS timer WITH ;
    Top = 0, ;
    Left = 156, ;
    Height = 23, ;
    Width = 23, ;
    Interval = 100, ;
    Name = "Timer1"

  Add OBJECT colorshower AS container WITH ;
    Top = 33, ;
    Left = 167, ;
    Width = 49, ;
    Height = 49, ;
    Name = "ColorShower"

  Procedure Load
  Declare Sleep in Win32API integer
  Declare short GetCursorPos in win32api string @ lpPoint
  Declare integer GetWindowDC in Win32API integer hWnd
  Declare integer GetPixel in win32API ;
    integer hdc, integer nXPos, integer nYPos
Endproc

  Procedure QueryUnload
  Clear events
Endproc

  Procedure timer1.Timer
  lpPoint = space(8)
  With thisform
    If GetCursorPos(@lpPoint)#0
      .posx = asc(substr(lpPoint,1))*256^0+;
        asc(substr(lpPoint,2))*256^1+;
        asc(substr(lpPoint,3))*256^2+;
        asc(substr(lpPoint,4))*256^3
      .posy = asc(substr(lpPoint,5))*256^0+;
        asc(substr(lpPoint,6))*256^1+;
        asc(substr(lpPoint,7))*256^2+;
        asc(substr(lpPoint,8))*256^3
      .pixelcolor = GetPixel(GetWindowDC(0), .posx, .posy)
      .colorshower.Backcolor = .pixelcolor
      .Refresh()
    Endif
  Endwith
Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform