mouse cursorunun bulunduğu yerdeki rengi alma
Tarih
19/04/2012 20:24
Konu Sahibi
accessman
Yorumlar
3
Okunma
1274
Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 5
  • 4
  • 3
  • 2
  • 1

Derecelendirme: 0/5 - 0 oy



accessman

Kullanici Avatari
Onursal
2.367
31/10/2008
425
Denizli
Ofis 2003
20/09/2016,00:20
Çözüldü 
Sponsor Reklam
bunu Access ile yapmak mümkün mü
aşağıda ki kod delphi için

Kod:
1
2
3
4
5
6
7
8
9
10
11
12
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:
1
2
3
4
5
6
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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


@benbendedeilem
Cevapla

accessman

Kullanici Avatari
Onursal
2.367
31/10/2008
425
Denizli
Ofis 2003
20/09/2016,00:20
Çözüldü 

Kod:
Dim thecolor As Color = DirectCast(PictureBox1.Image, Bitmap).GetPixel(x, y)


@benbendedeilem
Cevapla

accessman

Kullanici Avatari
Onursal
2.367
31/10/2008
425
Denizli
Ofis 2003
20/09/2016,00:20
Çözüldü 
Sponsor Reklam
yine delphiden

Kod:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    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;


@benbendedeilem
Cevapla

accessman

Kullanici Avatari
Onursal
2.367
31/10/2008
425
Denizli
Ofis 2003
20/09/2016,00:20
Çözüldü 
Bu accesddede olabilir mi
@benbendedeilem
Cevapla


Konuyu Okuyanlar: 1 Ziyaretçi


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Tarih Son Yorum
Question Tedarikçilere göre toplam alma ve form üzerinde gösterme safakben 5 151 12/01/2017, 12:58 atoz112
  Tarihe göre rapor alma ve seçilen tarihi raporda gösterme ertans 6 249 30/12/2016, 16:45 ertans
  webden veri alma, veri tabanına ekleme.... mbo69221088 15 365 10/12/2016, 00:08 mbo69221088
  Webden veri alma stringeer 11 326 08/12/2016, 09:26 stringeer
  Dosya konumunu alma tufanbal 7 231 02/12/2016, 10:48 tufanbal


Türkçe Çeviri: MCTR, Yazılım: MyBB, © 2002-2017 MyBB Group.
DMCA.com Protection Status
© Desing by XSTYLED| Develops by ozanakkaya