请教关于随着鼠标移动来 获取图像像素点的问题 图像的格式是bmp 在photoshop里面看到 当鼠标移动时 有信息是 RGB,XY,等 想知道 在delphi里面如何获取X Y的像素信息 因为要把图像放大 貌似放大的时候 像素点X Y是不变的 请教在delphi里面有没有什么方法实现: 当鼠标移动到哪个点 点击 就能出现此点的像素点 XY 谢谢~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是看整图的像素,你可以参考一下。。unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, FileCtrl, StdCtrls, ExtCtrls, Buttons, XPMan;type TForm1 = class(TForm) DriveComboBox1: TDriveComboBox; FileListBox1: TFileListBox; DirectoryListBox1: TDirectoryListBox; FilterComboBox1: TFilterComboBox; Label1: TLabel; BitBtn1: TBitBtn; XPManifest1: TXPManifest; procedure FileListBox1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FileListBox1Click(Sender: TObject);var image1:TImage;begin image1:=TImage.Create(nil); try image1.AutoSize:=true; if FileListbox1.Items.Count<>0 then begin Image1.Picture.LoadFromFile(FileListBox1.FileName); Label1.Caption:='图片象素:['+IntToStr(Image1.Width)+'*'+IntToStr(Image1.Height)+']'; end; finally image1.Free; end;end;end. procedure TForm1.Timer1Timer(Sender: TObject);var P: TPoint; T: TColor; R, G, B : byte;begin GetCursorPos(P); P := ScreenToClient(P); T := Canvas.Pixels[p.X, P.Y]; R := getRvalue(T); G := getGvalue(T); B := getBvalue(T); Caption := Format('%d %d %d %16x', [R, G, b, T]);end; 如果要求点击后显示鼠标处的像素点的坐标,只要在图像的onmousedown中添加相关语句就可以了procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin showmessage(inttostr(x)+','+inttostr(y));end;如果要求图像放大后像素点不变化,就要求把坐标x,y由绝对坐标转换成相对坐标就可以了。转换方式,可以选择以图像缩放前后的大小比例来定 procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin //X,Y为鼠标坐标 //Image1.Canvas.Pixels[x,y],这个为X,Y处的颜色end; 这种写法是什么意思? 关于dbgridsed!我放了个dbgridsed,在编译的时候怎么提示没找到gridsed.dcu!!!!!! 路径以及调用的问题 谁有加密组件? 如何把Variant类型的变量数据传递给array of byte类型的变量?高分相送 怎样将一个dataset中选中的记录转给别一个dataset? dat文件以及播放时间? Delphi6升级的问题,注册码 在線等候,請和位進來看一下.進者有分... 怎样让一个程序全屏运行?不是窗口最大化? 求 字体对话框 和颜色对话框 代码 含Params的语句编译通不过
这个是看整图的像素,你可以参考一下。。unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
FileCtrl, StdCtrls, ExtCtrls, Buttons, XPMan;type
TForm1 = class(TForm)
DriveComboBox1: TDriveComboBox;
FileListBox1: TFileListBox;
DirectoryListBox1: TDirectoryListBox;
FilterComboBox1: TFilterComboBox;
Label1: TLabel;
BitBtn1: TBitBtn;
XPManifest1: TXPManifest;
procedure FileListBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FileListBox1Click(Sender: TObject);
var
image1:TImage;
begin
image1:=TImage.Create(nil);
try
image1.AutoSize:=true;
if FileListbox1.Items.Count<>0 then
begin
Image1.Picture.LoadFromFile(FileListBox1.FileName);
Label1.Caption:='图片象素:['+IntToStr(Image1.Width)+'*'+IntToStr(Image1.Height)+']';
end;
finally
image1.Free;
end;
end;end.
procedure TForm1.Timer1Timer(Sender: TObject);
var
P: TPoint;
T: TColor;
R, G, B : byte;
begin
GetCursorPos(P);
P := ScreenToClient(P);
T := Canvas.Pixels[p.X, P.Y]; R := getRvalue(T);
G := getGvalue(T);
B := getBvalue(T);
Caption := Format('%d %d %d %16x', [R, G, b, T]);
end;
Shift: TShiftState; X, Y: Integer);
begin
showmessage(inttostr(x)+','+inttostr(y));
end;如果要求图像放大后像素点不变化,就要求把坐标x,y由绝对坐标转换成相对坐标就可以了。转换方式,可以选择以图像缩放前后的大小比例来定
Y: Integer);
begin
//X,Y为鼠标坐标
//Image1.Canvas.Pixels[x,y],这个为X,Y处的颜色
end;