◢◤如何取得屏幕上任意点的颜色?谢谢指教◥◣ 前提:我取得了鼠标在屏幕上任意移动时的当前坐标,保存在x,y中,请问我如何才能取得当前点的颜色?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 像下面这样子写,但取到的始终为黑色,晕倒~~~procedure TForm1.Timer1Timer(Sender: TObject);var CurDC: HDC; CurPoint: TPoint; Color: TColor;begin CurDC := GetDesktopWindow; GetCursorPos(CurPoint); Color := GetPixel(curdc,CurPoint.x,CurPoint.y); text1.color:=color;end; 这个你试试,哈哈,给我分吧procedure TForm1.Timer1Timer(Sender: TObject);var CurDC: HDC; CurPoint: TPoint; Color: TColor;begin CurDC := GetDC(GetActiveWindow); //GetDesktopWindow GetCursorPos(CurPoint); CurPoint := ScreenToClient(CurPoint); Color := GetPixel(curdc,CurPoint.x,CurPoint.y); Panel1.color:=color;end; procedure TForm1.Timer1Timer(Sender: TObject);var CurDC: HDC; CurPoint: TPoint; Color: TColor;begin CurDC := GetDC(0); if CurDC <> NULL then try GetCursorPos(CurPoint); Color := GetPixel(CurDC,CurPoint.x,CurPoint.y); Panel1.Color:=Color; Edit1.Text := '$'+IntToHex(Color, 8); finally ReleaseDC(0, CurDC); end;end; 试试这个procedure TForm1.Timer1Timer(Sender: TObject);var CurDC: HDC; CurPoint: TPoint; Color: TColor;begin CurDC := GetDC(GetActiveWindow); //GetDesktopWindow GetCursorPos(CurPoint); CurPoint := ScreenToClient(CurPoint); Color := GetPixel(curdc,CurPoint.x,CurPoint.y); Panel1.color:=color;end; 终于理解EM的Delphi路线图的良苦用心和处境 [高手进]关于Parent的问题,问题解决即给分:) Urgnet:怎么代码控制dxComponentPrinter的Header,Footer,热切期盼您的帮助! 一个错误,请指点迷津!!! DBGRID中的LOOKUP字段如何控制 兄弟们,来玩玩我做的多点下载,多人语音视频聊天系统,有意思哦 EOleException是什么异常? 如何在statusbar里显示当前的日期、时间等 如何动态建立或删除索引?比如按BOTTON响应删除某索引?? 关于颜色显示的问题。 小妹求助 谁知道哪能找到MapX的源代码?
procedure TForm1.Timer1Timer(Sender: TObject);
var
CurDC: HDC;
CurPoint: TPoint;
Color: TColor;
begin
CurDC := GetDesktopWindow;
GetCursorPos(CurPoint);
Color := GetPixel(curdc,CurPoint.x,CurPoint.y);
text1.color:=color;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
CurDC: HDC;
CurPoint: TPoint;
Color: TColor;
begin
CurDC := GetDC(GetActiveWindow); //GetDesktopWindow
GetCursorPos(CurPoint);
CurPoint := ScreenToClient(CurPoint);
Color := GetPixel(curdc,CurPoint.x,CurPoint.y);
Panel1.color:=color;
end;
var
CurDC: HDC;
CurPoint: TPoint;
Color: TColor;
begin
CurDC := GetDC(0);
if CurDC <> NULL then
try
GetCursorPos(CurPoint);
Color := GetPixel(CurDC,CurPoint.x,CurPoint.y);
Panel1.Color:=Color;
Edit1.Text := '$'+IntToHex(Color, 8);
finally
ReleaseDC(0, CurDC);
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
CurDC: HDC;
CurPoint: TPoint;
Color: TColor;
begin
CurDC := GetDC(GetActiveWindow); //GetDesktopWindow
GetCursorPos(CurPoint);
CurPoint := ScreenToClient(CurPoint);
Color := GetPixel(curdc,CurPoint.x,CurPoint.y);
Panel1.color:=color;
end;