• AutoCAD.Net/C#.Net QQ群:193522571 AutoCAD中状态栏


    AutoCAD中状态栏类:

      public sealed class StatusBar
      {
        protected StatusBar(AcApStatusBar* impObj);
    
        public PaneCollection Panes { get; }
        public TrayItemCollection TrayItems { get; }
        public Window Window { get; }
    
        public void CloseBubbleWindows();
        public Pane GetDefaultPane(DefaultPane pane);
        public void RemoveDefaultPane(DefaultPane pane);
        public void Update();
      }

    其中Panes中包含默认Pane,默认Pane的枚举如下:

      public enum DefaultPane
      {
        ModeMacro = 0,
        CursorCoordinates = 1,
        Snap = 2,
        Grid = 3,
        Ortho = 4,
        Polar = 5,
        ObjectTrack = 6,
        LineWeight = 7,
        PaperModel = 8,
        Paper = 9,
        Model = 10,
        ObjectSnap = 11,
        Float = 12,
        Table = 13,
        Spacer = 14,
        ViewportMaximizePrevious = 15,
        ViewportMaximize = 16,
        ViewportMaximizeNext = 17,
        DynamicInput = 18,
        DynamicUcs = 19,
        LayoutModelIcons = 20,
        ModelIcon = 21,
        LayoutIcon = 22,
        LayoutMoreIcon = 23,
        All = 24,
      }
    View Code

    测试后发现移除了默认Pane后,想再加入其中一项就会导致内存出错。

    原本打算先移除掉再加上走不通,不过Panes中包含了一个可以让用户自定义值的Pane,即:ModeMacro,其默认visible为false,初始值为“.”,后面发现移除不了默认的pane可以将其隐藏,显示了用户的值后再将其恢复,同样可以达到预计效果。

    显示用户文本:

            foreach (Pane p in AcadApplication.StatusBar.Panes)
            {
              if (p.Text != ".")
              {
                p.Visible = false;
              }
              else
              {
                p.Visible = true;
                p.Text = statusBarValue;
              }
            }
            AcadApplication.StatusBar.Update();

    恢复默认:

          foreach (Pane p in AcadApplication.StatusBar.Panes)
          {
            if (p.Text == statusBarValue)
            {
              p.Text = ".";
              p.Visible = false;
            }
            else
            {
              p.Visible = true;
            }
          }
          AcadApplication.StatusBar.Update();
  • 相关阅读:
    Docker可视化管理工具Portainer
    Spring Cloud,Docker书籍资源、优秀博文等记录
    Grafana部署监控docker服务
    Grafana+Prometheus通过node_exporter监控Linux服务器信息
    Prometheus+Grafana+kafka_exporter监控kafka
    k8s gpu 资源设置
    mysql 塞数据
    idea 插件
    ubuntu 升级内核
    清华镜像站安装docker
  • 原文地址:https://www.cnblogs.com/swtool/p/4936038.html
Copyright © 2020-2023  润新知