if image1.picture.icon='' then
begin
.....
end;1.出错!!
image1.picture.icon='' ???怎么判断image1里没有图像??2. 屏蔽书标右键
if button=mbright then
begin
if image1.picture.icon='' then
begin
屏蔽书标右键
end;
end;
begin
.....
end;1.出错!!
image1.picture.icon='' ???怎么判断image1里没有图像??2. 屏蔽书标右键
if button=mbright then
begin
if image1.picture.icon='' then
begin
屏蔽书标右键
end;
end;
if not assign(image1.picture.icon) then
if not assign(image1.picture.icon) then
begin
end;
你给的代码出错??
判断里没有图像??
if image1.Picture.Bitmap.Empty then
image1.Picture.LoadFromFile('D:\Program Files\Borland\Borland Shared\Images\Icons\chip16.bmp');
tjff2000(fengyun) 可以了。
但是还差一点怎么屏蔽书标右键
(2)然后在窗口的OnMouseDown事件中写入如下语句:
procedure TMainForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
ScrnPt: TPoint;
begin
if not ( (Button = mbRight) and
(PtInRect(Image1.BoundsRect, Point(X, Y))) ) then
begin // 需要同时满足是鼠标右键按下,并且按下的区域不在Image1所在的矩形区域内。
ScrnPt := ClientToScreen(Point(X, Y));
PopupMenu1.Popup(ScrnPt.X, ScrnPt.Y);
end;
end;
if not Assigned(Image1.Picture.Icon) then ...
if Image1.Picture.Icon <> nil then ...
如果image里面有图的话,单击图就不见了??
你以上的判断是否有图片的两种方法都不正确,可以用
if image1.Picture.Bitmap.Empty then
or if image1.Picture.Icon.Empty then都行。
to cjdbd()
你看看下面的代码可否
if (image1.Picture.bitmap.Empty) and (button=mbright) then
popupmenu1.AutoPopup:=false;