参考:
1]: Picture:载入要显示的图片,也可从 DEV自带 Icon Library库里选择
2]: Properties->Caption在没有内容的时候显示在图片框中间的文字
3]: Properties->PopupMenuLayout->MenuItems可选择需要显示在图片上的右键菜单命令
4] 用代码 转入 保存 图片
5] 显示 缩放 水平栏
1]: Picture:载入要显示的图片,也可从 DEV自带 Icon Library库里选择
2]: Properties->Caption在没有内容的时候显示在图片框中间的文字
3]: Properties->PopupMenuLayout->MenuItems可选择需要显示在图片上的右键菜单命令
右键 自定义 菜单事件
再添加 自定义 事件
procedure TForm2.cxImage1PropertiesCustomClick(Sender: TObject);
begin
showmessage('右键 自定义 菜单事件')
end;
4] 用代码 转入 保存 图片
//载入图片
procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
cxImage1.Picture.LoadFromFile(OpenDialog1.FileName);
end;
end;
//保存图片
procedure TForm1.Button3Click(Sender: TObject);
begin
if SavePictureDialog1.Execute then
begin
cxImage1.Picture.SaveToFile(SavePictureDialog1.FileName);
end;
end;
5] 显示 缩放 水平栏
[a] 设置 cxImage1的Properties.FitMode 属性为 ifmNormal.
[b] Specify the zoom range (MinZoom and MaxZoom);
[c] Adjust the zoom level of the currently displayed image (ZoomPercent);
[d] Control the visibility of the zoom track bar and its change buttons (ShowZoomTrackBar).
在鼠标 滑过 cxImage1时,即可看到 缩放 水平栏
Delphi cxImage控件隐藏选中时的边框
//鼠标点击时是否显示边框
cxImage1.Properties.ShowFocusRect:= False;
运行时可移动
procedure TForm2.cxImage1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
releaseCapture;
cximage1.Perform(WM_SYSCOMMAND,SC_MOVE+1,0);
end;
响应鼠标滑轮事件