• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

ArcGIS Pro 修改一个图片element

 1 IEnumerable<LayoutProjectItem> layouts = Project.Current.GetItems<LayoutProjectItem>();
 2             foreach (LayoutProjectItem layoutItem in layouts)
 3                 if (layoutItem != null)
 4                 {
 5                     await QueuedTask.Run(() =>
 6                     {
 7                         Layout layout = layoutItem.GetLayout();
 8                         if (layout != null)
 9                         {
10                             if (layout.FindElement("Client Logo") is PictureElement picElm)
11                             {
12                                 if (Equals(Module1.LayoutLogo, picElm.SourcePath.ToString()))
13                                 {
14                                 }
15                                 else
16                                 {
17                                     try
18                                     {
19                                         if (Module1.LayoutLogo != null)
20                                         {
21                                             picElm.SetSourcePath($@"{Module1.LayoutLogo}");
22                                             var lyt_cim = layout.GetDefinition();
23                                             layout.SetDefinition(lyt_cim);
24                                         }
25                                     }
26                                     catch (Exception)
27                                     {
28                                         ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Incorrect Client Logo File Path", "Failure", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning);
29                                     }
30                                 }
31                             }
32                         }
33                     });
34                 }

 

posted on 2022-10-06 09:40  gisai  阅读(102)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3