如何判断两个speedbutton是不是用的一个glyph?
解决方案 »
- 怎样动态创建数据库文件?for Access 2007
- 调查一下这里有多少Delphi程序员上“Delphi K.Top討論區”
- 我已经成功用socket应用ftp协议下载,但是通过代理服务器时,还有技术问题没解决,请高手进来!!!
- runtime时创建控件
- 数据库发布问题
- 请教一个存储过程的问题。
- 计算filelistbox中每个字符串的宽度?delphi
- delphi treeview 中的 htOnItem in tv1.GetHitTestInfoAt(X,Y)
- 把dephi自带的库数据导入到oracle中去!
- ReganCai(闪电边缘)兄请进--[关于如何用代码模拟搜索引擎的行为]
- 客户端断开后怎样重新连接?
- 错误提示
你是怎么调用的图片?
在设计期直接调用的?
还是在运行期通过程序代码调用的?什么都没说清楚,让人怎么回答你
if speedbutton1.glyph = speedbutton2.glyph then
………………好像不能这样判断
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..32767] of TRGBTriple;
var
x, y: integer;
p0, p1: PRGBTripleArray;
sBmp, dBmp: TBitMap;
begin
Result := False; if (bmp1.Height <> bmp2.Height) or
(bmp1.Width <> bmp2.Width) then
begin
Exit;
end; sBmp := TBitmap.Create;
dBmp := TBitmap.Create;
try
sBmp.Assign(bmp1);
dBmp.Assign(bmp2);
sBmp.PixelFormat := pf24bit;
dBmp.PixelFormat := pf24bit;
for y := 0 to sBmp.Height - 1 do
begin
p0 := sBmp.ScanLine[y];
p1 := dBmp.ScanLine[y];
for x := 0 to sBmp.Width - 1 do
if (p0[x].rgbtBlue = p1[x].rgbtBlue) and
(p0[x].rgbtGreen = p1[x].rgbtGreen) and
(p0[x].rgbtRed = p1[x].rgbtRed) then
begin
Result := True;
end
else
begin
Break;
end;
end;
finally
sBmp.Free;
dBmp.Free;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if IsHomology(SpeedButton1.Glyph, SpeedButton2.Glyph) then
showmessage('相同');
end;
function IsHomology(bmp1, bmp2: TbitMap): boolean;
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..32767] of TRGBTriple;
var
x, y: integer;
p0, p1: PRGBTripleArray;
sBmp, dBmp: TBitMap;
begin
Result := False; if (bmp1.Height <> bmp2.Height) or
(bmp1.Width <> bmp2.Width) then
begin
Exit;
end; sBmp := TBitmap.Create;
dBmp := TBitmap.Create;
try
sBmp.Assign(bmp1);
dBmp.Assign(bmp2);
sBmp.PixelFormat := pf24bit;
dBmp.PixelFormat := pf24bit;
for y := 0 to sBmp.Height - 1 do
begin
p0 := sBmp.ScanLine[y];
p1 := dBmp.ScanLine[y];
for x := 0 to sBmp.Width - 1 do
if (p0[x].rgbtBlue = p1[x].rgbtBlue) and
(p0[x].rgbtGreen = p1[x].rgbtGreen) and
(p0[x].rgbtRed = p1[x].rgbtRed) then
begin
Result := True;
end
else
begin
Result:=False; /////////////这里少了一句
Break;
end;
end;
finally
sBmp.Free;
dBmp.Free;
end;
end;
if(SpeedButton1.Glyph.GetNamePath = SpeedButton2.Glyph.GetNamePath) then
ShowMessage('Same');
SpeedButton1.Glyph.GetNamePath取不出来值