mouse cursorunun bulunduğu yerdeki rengi alma

19/04/2012, 20:24

accessman

bunu Access ile yapmak mümkün mü
aşağıda ki kod delphi için

Kod:
procedure TForm1.Button2Click(Sender: TObject);
var
point:TPoint; // kursor'un bulundugu yer
pikselrengi:TColor;
ScreenDC: HDC;
begin
getcursorpos(point); // kursor'un bulundugu yerin kordinatlarini oku
if (form1.Canvas.Pixels[point.x,point.y]=clBlack) then
begin
ShowMessage('siyah');
end else ShowMessage('değil');
end;

bu olabilir mi acaba

Kod:
Private Sub MainPage_MouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseLeftButtonDown
    Dim wb = New WriteableBitmap(MyImage, Nothing)
    Dim xa As Integer = e.GetPosition(MyImage).X
    Dim ya As Integer = e.GetPosition(MyImage).Y
    Label1.Content = wb.Pixels(ya * wb.PixelWidth + xa)
End Sub

Kod:
PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB]

bu ne işe yarıyor olabilir acab bu konu ile mi ilgili
Kod:
Option Compare Database

Declare Sub GetCursorPos Lib "user32" (lpPoint As typPOINTAPI)

Type typPOINTAPI
x As Long
Y As Long
End Type

Declare Function apiGetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT_Type) As Long
Declare Function apiGetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function apiReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function apiGetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function apiGetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
Declare Function apiGetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long
Declare Function apiGetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassname As String, ByVal nMaxCount As Long) As Long

Global Const TWIPSPERINCH = 1440

Sub ConvertPixelsToTwisps(l As Long, t As Long, x As Long, Y As Long)
On Error GoTo myErr

Dim hdc As Long, hwnd As Long, RetVal As Long, XPIXELSPERINCH, YPIXELSPERINCH

Const LOGPIXELSX = 88
Const LOGPIXELSY = 90

'get the current number of pixels per inch, which is
resolution -dependent:
hdc = apiGetDC(0)
XPIXELSPERINCH = apiGetDeviceCaps(hdc, LOGPIXELSX)
YPIXELSPERINCH = apiGetDeviceCaps(hdc, LOGPIXELSY)
RetVal = apiReleaseDC(0, hdc)

'compute and return the measurements in twips:
If l > 0 Then l = (l / XPIXELSPERINCH) * TWIPSPERINCH '>left
If t > 0 Then t = (t / XPIXELSPERINCH) * TWIPSPERINCH '>top
x = (x / XPIXELSPERINCH) * TWIPSPERINCH '>width
Y = (Y / YPIXELSPERINCH) * TWIPSPERINCH '>height

myExit:
Exit Sub
myErr:
MsgBox Err.Number & " " & Err.Description
Resume myExit
End Sub

'In the module opening your form paste the following:

Function OpenMyForm(myFrm As String)
'myFrm is the name of your form to open to your current mouse pointer location

Dim TipPoint As typPOINTAPI, myvar1 As Long, myvar2 As Long, myFrm As String, myStatusFile As String
'get the current mouse position:
GetCursorPos TipPoint

myvar1 = (TipPoint.x)
myvar2 = (TipPoint.Y)

Call ConvertPixelsToTwisps(myvar1, myvar2, 0, 0)

DoCmd.OpenForm myFrm

'>position the form
DoCmd.MoveSize myvar1, myvar2

End Function
19/04/2012, 21:24

accessman

Kod:
Dim thecolor As Color = DirectCast(PictureBox1.Image, Bitmap).GetPixel(x, y)
19/04/2012, 21:35

accessman

yine delphiden
Kod:
function renkoku(x,y:integer): Tcolor;
    var
    DCDesk: HDC;
    bmp: Tbitmap;
    begin
      bmp := TBitmap.Create;
      bmp.height:=screen.height;
      bmp.width:=screen.width;
      DCDesk:=GetWindowDC(GetDesktopWindow);
      BitBlt(bmp.Canvas.Handle, 0, 0, Screen.Width, Screen.Height,DCDesk, 0, 0,SRCCOPY);
      ReleaseDC(GetDesktopWindow, DCDesk);
      result:=bmp.Canvas.Pixels[x,y];
      bmp.free;
    end;
22/04/2012, 13:21

accessman

Bu accesddede olabilir mi
11/04/2020, 17:19

accessman

Keşke olsaydı