cxImage1图片显示(17)
  iC0dxxaBBoLD 2023年11月30日 22 0

参考:

1]:     Picture:载入要显示的图片,也可从 DEV自带 Icon Library库里选择

2]:    Properties->Caption在没有内容的时候显示在图片框中间的文字

3]:    Properties->PopupMenuLayout->MenuItems可选择需要显示在图片上的右键菜单命令

4]     用代码 转入 保存 图片 

5]     显示 缩放 水平栏


 

1]:     Picture:载入要显示的图片,也可从 DEV自带 Icon Library库里选择

cxImage1图片显示(17)_缩放

2]:    Properties->Caption在没有内容的时候显示在图片框中间的文字

cxImage1图片显示(17)_自定义_02

3]:    Properties->PopupMenuLayout->MenuItems可选择需要显示在图片上的右键菜单命令

cxImage1图片显示(17)_Layout_03

右键 自定义 菜单事件

cxImage1图片显示(17)_缩放_04

 再添加 自定义 事件

cxImage1图片显示(17)_缩放_05

procedure TForm2.cxImage1PropertiesCustomClick(Sender: TObject);
begin
showmessage('右键 自定义 菜单事件')
end;

cxImage1图片显示(17)_Layout_06


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.

cxImage1图片显示(17)_缩放_07

[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图片显示(17)_自定义_08

 在鼠标 滑过 cxImage1时,即可看到 缩放 水平栏

cxImage1图片显示(17)_Layout_09

 Delphi cxImage控件隐藏选中时的边框

//鼠标点击时是否显示边框
cxImage1.Properties.ShowFocusRect:= False;

cxImage1图片显示(17)_Layout_10

 运行时可移动

procedure TForm2.cxImage1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  releaseCapture;
  cximage1.Perform(WM_SYSCOMMAND,SC_MOVE+1,0);
end;

响应鼠标滑轮事件


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月30日 0

暂无评论

推荐阅读
iC0dxxaBBoLD