1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using SuperMap.Mapping;
- using SuperMap.UI;
- using System.Windows.Forms;
- namespace WWPipeLine.MapBasic
- {
- public class LayersTreeEx : ToolWindowExtend
- {
- private MapControl m_MapControl;
- public LayersTree m_LayersTree;
- public LayersTreeEx(MapControl m)
- {
- this.TabText = "图层列表";
- this.Text = "LayersTreeEx图层列表";
- this.Tag = "MainControls";
- m_MapControl = m;
- m_LayersTree = new LayersTree { Name = "LayersTreeEx", Dock = DockStyle.Fill };
- m_LayersTree.LabelEdit = false;
- m_LayersTree.Font = new System.Drawing.Font("微软雅黑", 9);
- m_LayersTree.ItemHeight = 23;
- m_LayersTree.ShowRootLines = true;
- m_LayersTree.MultiSelect = false;//获取或设置是否支持同时选中多个树节点。 默认为值 true。
- m_LayersTree.DragNodeEnabled = false;//是否启用拖拽节点功能,false表示不启用,此时,所有选中树节点的拖动鼠标操作都无效。
- m_LayersTree.ShowVisibleScaleSign = true;//获取或设置是否在图层图标位置显示最大或最小比例尺的标识。
- m_LayersTree.Icons = TreeIconTypes.Visible | TreeIconTypes.Selectable | TreeIconTypes.TypeIcon;
- m_LayersTree.Map = m_MapControl.Map;
- m_LayersTree.Interactions[InteractionType.KeyF2] = new KeyEventHandler(KeyEventHandlerNull);
- m_LayersTree.Interactions[InteractionType.NodeDrop] = new KeyEventHandler(KeyEventHandlerNull);
- m_LayersTree.Interactions[InteractionType.KeyDelete] = new KeyEventHandler(KeyEventHandlerNull);
- m_LayersTree.Interactions[InteractionType.FileDrop] = new KeyEventHandler(KeyEventHandlerNull);
- this.Controls.Add(m_LayersTree);
- }
- private void LayersTreeEx_Load(object sender, System.EventArgs e)
- {
- //foreach (TreeNode treeNode in m_LayersTree.Nodes)
- //{
- // if (treeNode.Nodes.Count > 0) treeNode.ExpandAll();
- //}
- //LayerGroup lg = m_MapControl.Map.Layers.FindLayer("LayerGroup#1") as LayerGroup;
- //foreach (Layer r in lg)
- //{
- // r.IsVisible = false;
- // r.IsEditable = false;
- // r.IsSelectable = false;
- //}
- //foreach (Layer r in ComsStatic.MapLayers)
- //{
- // r.IsEditable = false;
- //}
- //m_LayersTree.ExpandAll();
- }
- private void KeyEventHandlerNull(object sender = null, KeyEventArgs e = null) { e.Handled = true; }
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // LayersTreeEx
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Name = "LayersTreeEx";
- this.Text = "LayerTreeExText";
- this.ResumeLayout(false);
- }
- }
- }
|