Exemple #1
0
        private void AddLayerToMap(ILayerItem layer)
        {
            if (layer.AddedToMap)
            {
                _layerService.RemoveLayer(layer.Identity);
            }
            else
            {
                if (layer is IDatabaseLayerItem)
                {
                    var item = layer as IDatabaseLayerItem;

                    if (item.Loading)
                    {
                        MessageService.Current.Info("This layer is being added to the map.");
                        return;
                    }

                    AddLayerToMapAsync(layer as IDatabaseLayerItem);
                }
                else
                {
                    if (_layerService.AddLayerIdentity(layer.Identity))
                    {
                        int handle = _layerService.LastLayerHandle;
                        _context.Map.ZoomToLayer(handle);
                    }
                }
            }
        }
        private ILayerItem GetGroupLayerItems(IElementGroup group)
        {
            ILayerItemGroup itemGroup = new LayerItemGroup(group.Name ?? string.Empty, group.Name ?? string.Empty);

            (itemGroup as LayerItemGroup).Tag = group;
            itemGroup.IsSelected = group.IsSelected;
            itemGroup.IsVisible  = group.Visible;
            foreach (IElement it in group.Elements)
            {
                if (it is IElementGroup)
                {
                    ILayerItem layer = GetGroupLayerItems(it as IElementGroup);
                    itemGroup.Items.Add(layer);
                }
                else
                {
                    LayerItemLayout item = new LayerItemLayout();
                    item.Name       = it.Name;
                    item.IsVisible  = it.Visible;
                    item.IsSelected = it.IsSelected;
                    item.Tag        = it;
                    if (it.Icon != null)
                    {
                        item.Image = it.Icon;
                    }
                    itemGroup.Items.Add(item);
                }
            }
            return(itemGroup);
        }
 public void AdjustOrder(int insertIndex, ILayerItem item)
 {
     if (item.Tag is CodeCell.AgileMap.Core.ILayer)
     {
         foreach (GeoDo.RSS.Core.DrawEngine.ILayer layer in _viewer.Canvas.LayerContainer.Layers)
         {
             if (layer is IVectorHostLayer)
             {
                 IVectorHostLayer hostLayer        = layer as IVectorHostLayer;
                 IMap             map              = hostLayer.Map as IMap;
                 CodeCell.AgileMap.Core.ILayer lyr = item.Tag as CodeCell.AgileMap.Core.ILayer;
                 map.LayerContainer.AdjustOrder(lyr, map.LayerContainer.Layers[insertIndex]);
                 foreach (ILayerItem it in Items)
                 {
                     if (it is ILayerItemGroup && it.Tag is IVectorHostLayer)
                     {
                         (it as ILayerItemGroup).Items.Remove(item);
                         (it as ILayerItemGroup).Items.Insert(insertIndex, item);
                     }
                 }
                 break;
             }
         }
     }
     if (item.Tag is GeoDo.RSS.Core.DrawEngine.IRenderLayer || item.Tag is IVectorHostLayer)
     {
         this.Items.Remove(item);
         this.Items.Insert(insertIndex, item);
         _viewer.Canvas.LayerContainer.Layers.Remove(item.Tag as GeoDo.RSS.Core.DrawEngine.ILayer);
         _viewer.Canvas.LayerContainer.Layers.Insert(insertIndex, item.Tag as GeoDo.RSS.Core.DrawEngine.ILayer);
     }
     RefreshViewer();
 }
 private void GetItems(ILayoutViewer viewer)
 {
     foreach (IElement it in viewer.LayoutHost.LayoutRuntime.Layout.Elements)
     {
         ILayerItem item = GetLayerItemLayout(it);
         Items.Add(item);
     }
 }
 public void SetLayerName(string newName, ILayerItem layer)
 {
     if (layer.Tag is IElement)
     {
         (layer.Tag as IElement).Name = newName;
     }
     layer.Name = newName;
 }
Exemple #6
0
 private void SetAllChildrenVisible(ILayerItem parent, bool isVisible)
 {
     if (parent is ILayerItemGroup)
     {
         foreach (ILayerItem item in (parent as ILayerItemGroup).Items)
         {
             item.IsVisible = isVisible;
             SetAllChildrenVisible(item, isVisible);
         }
     }
 }
 //调整二级及以上节点顺序
 public void AdjustOrder(int insertIndex, ILayerItem item, ILayerItem parentItem)
 {
     if (parentItem == null)
     {
         return;
     }
     (parentItem as ILayerItemGroup).Items.Remove(item);
     (parentItem as ILayerItemGroup).Items.Insert(insertIndex, item);
     foreach (IElement ele in _viewer.LayoutHost.LayoutRuntime.Layout.Elements)
     {
         if (ele is ILayerObjectContainer)
         {
             ILayerObjectContainer container = ele as ILayerObjectContainer;
             //ILayerObjectBase insertObj = item.Tag as ILayerObjectBase;
             foreach (ILayerObjectBase obj in container.LayerObjects)
             {
                 if (obj is ILayerObject)
                 {
                     ILayerObject layerObj = obj as ILayerObject;
                     if (layerObj.Tag.Equals(item.Tag))
                     {
                         container.LayerObjects.Remove(layerObj);
                         container.LayerObjects.Insert(insertIndex, layerObj);
                         RefreshViewer();
                         return;
                     }
                 }
                 if (obj is ILayerObjecGroup)
                 {
                     ILayerObjecGroup layerGrp = obj as ILayerObjecGroup;
                     foreach (ILayerObjectBase it in layerGrp.Children)
                     {
                         if ((it as ILayerObject).Tag.Equals(item.Tag))
                         {
                             layerGrp.Children.Remove(it);
                             layerGrp.Children.Insert(insertIndex, it);
                             RefreshViewer();
                             return;
                         }
                     }
                 }
             }
         }
         if (ele.Equals(parentItem) && ele is IElementGroup)
         {
             IElementGroup group = ele as IElementGroup;
             group.Elements.Remove(item.Tag as IElement);
             group.Elements.Insert(insertIndex, item.Tag as IElement);
             RefreshViewer();
             return;
         }
     }
 }
 public void Remove(ILayerItem item)
 {
     if (item is ILayerItemGroup)
     {
         foreach (ILayerItem it in (item as ILayerItemGroup).Items)
         {
             this.Items.Remove(it);
         }
         if (item.Tag is IVectorHostLayer)
         {
             IVectorHostLayer hostLayer = item.Tag as IVectorHostLayer;
             IMap             map       = hostLayer.Map as IMap;
             if (map.LayerContainer.Layers != null && map.LayerContainer.Layers.Count() != 0)
             {
                 foreach (CodeCell.AgileMap.Core.ILayer it in map.LayerContainer.Layers)
                 {
                     map.LayerContainer.Remove(it);
                 }
             }
             Update();
         }
     }
     if (item.Tag is GeoDo.RSS.Core.DrawEngine.IRenderLayer)
     {
         if (item.Tag is GeoDo.RSS.Core.DrawEngine.IRasterLayer)
         {
             return;
         }
         else if (item.Tag is GeoDo.RSS.Core.DrawEngine.IVectorLayer)
         {
             IRenderLayer layer = item.Tag as IRenderLayer;
             _viewer.Canvas.LayerContainer.Layers.Remove(item.Tag as IRenderLayer);
             this.Items.Remove(item);
             return;
         }
     }
     if (item.Tag is CodeCell.AgileMap.Core.ILayer)
     {
         foreach (GeoDo.RSS.Core.DrawEngine.ILayer layer in _viewer.Canvas.LayerContainer.Layers)
         {
             if (layer is IVectorHostLayer)
             {
                 IVectorHostLayer hostLayer = layer as IVectorHostLayer;
                 IMap             map       = hostLayer.Map as IMap;
                 map.LayerContainer.Remove(item.Tag as CodeCell.AgileMap.Core.ILayer);
                 Update();
             }
         }
         this.Items.Remove(item);
     }
     RefreshViewer();
 }
Exemple #9
0
        private int GetOffsetLeft(ILayerItem it)
        {
            int        n      = 0;
            ILayerItem parent = FindLayerParent(it);

            while (parent != null)
            {
                n++;
                it     = parent;
                parent = FindLayerParent(it);
            }
            return((n - 1) * cstGroupLeftRemainBank);
        }
Exemple #10
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     if (_focusedItem != null)
     {
         if (OnLayerItemClick != null)
         {
             OnLayerItemClick(_focusedItem);
             _currentLayerItem = _focusedItem;
             return;
         }
     }
     _currentLayerItem = null;
 }
 private void ucLayerManager_OnLayerItemClick(ILayerItem layerItem)
 {
     if (layerItem == null)
     {
         return;
     }
     if (layerItem.Tag != null)
     {
         propertyGrid.SelectedObject = layerItem.Tag;
     }
     else
     {
         propertyGrid.SelectedObject = new object();
     }
 }
Exemple #12
0
 public void SetLayerItemUp()
 {
     if (_currentLayerItem != null)
     {
         ILayerItem parent = FindLayerParent(_currentLayerItem);
         if (parent == null)
         {
             return;
         }
         int idx = (parent as ILayerItemGroup).Items.IndexOf(_currentLayerItem);
         idx = (idx - 1) < 0 ? 0 : --idx;
         _provider.AdjustOrder(idx, _currentLayerItem);
         Update();
     }
 }
Exemple #13
0
 private void FindFocusedLayerItem(Point pt, ILayerItem layerItem)
 {
     if (_helpers[layerItem].Bounds.Contains(pt))
     {
         _focusedItem = layerItem;
         return;
     }
     if ((layerItem is ILayerItemGroup) && !_helpers[layerItem].IsCollpased && (layerItem as ILayerItemGroup).Items.Count > 0)
     {
         foreach (ILayerItem it in (layerItem as ILayerItemGroup).Items)
         {
             FindFocusedLayerItem(pt, it);
         }
     }
 }
Exemple #14
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     try
     {
         Cursor = Cursors.Default;
         if (e.Button == MouseButtons.Right)
         {
             contextMenuStrip.Show(this, e.Location);
             return;
         }
         ILayerItem targetLayerItem = null;
         if (_isDraging && _dragLayerItem != null && Math.Abs(e.Location.Y - beginDrapPoint.Y) > 6)
         {
             FindFocusedLayer(e.Location, _provider);
             targetLayerItem = _focusedItem;
             if (targetLayerItem != null)
             {
                 ILayerItem parent     = FindLayerParent(targetLayerItem);
                 ILayerItem dragParent = FindLayerParent(_dragLayerItem);
                 if (parent == null)
                 {
                     return;
                 }
                 if (targetLayerItem.Equals(_dragLayerItem) || !parent.Equals(dragParent))
                 {
                     _provider.Group(_dragLayerItem, parent as ILayerItemGroup);
                     Update();
                     return;
                 }
                 int        idx          = -1;
                 ILayerItem desLayerItem = null;
                 idx          = (parent as ILayerItemGroup).Items.IndexOf(targetLayerItem);
                 desLayerItem = parent;
                 _provider.AdjustOrder(idx, _dragLayerItem);
                 Update();
             }
             return;
         }
         _dragLayerItem = null;
     }
     finally
     {
         beginDrapPoint = Point.Empty;
         _dragLayerItem = null;
         _isDraging     = false;
     }
 }
 public void SetLayerName(string newName, ILayerItem layer)
 {
     if (layer.Tag is CodeCell.AgileMap.Core.ILayer)
     {
         (layer.Tag as CodeCell.AgileMap.Core.ILayer).Name = newName;
         layer.Name = newName;
     }
     else if (layer.Tag is IVectorHostLayer)
     {
         layer.Name = newName;
     }
     else if (layer.Tag is IRenderLayer)
     {
         layer.Name = newName;
     }
 }
 public void SaveVectorItemShowMethod(ILayerItem item)
 {
     if (item.Tag is CodeCell.AgileMap.Core.FeatureLayer)
     {
         FeatureLayer layer = item.Tag as FeatureLayer;
         if (layer != null)
         {
             FileDataSource dataSource = layer.Class.DataSource as FileDataSource;
             if (dataSource == null)
             {
                 return;
             }
             string fileUrl = dataSource.FileUrl;
             if (string.IsNullOrEmpty(fileUrl))
             {
                 return;
             }
             string sourceFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"SystemData\MapTemplate.mcd");
             if (!File.Exists(sourceFileName))
             {
                 return;
             }
             string shpName     = Path.GetFileNameWithoutExtension(fileUrl);
             string newFileName = Path.Combine(Path.GetDirectoryName(fileUrl), shpName + ".mcd");
             File.Copy(sourceFileName, newFileName, true);
             XmlDocument doc = new XmlDocument();
             doc.Load(newFileName);
             XmlNode layerNodes = doc.SelectSingleNode("Map").SelectSingleNode("Layers");
             if (layerNodes == null)
             {
                 return;
             }
             IPersistable  persist   = layer as IPersistable;
             PersistObject layerObj  = persist.ToPersistObject();
             XmlNode       layerNode = GetXmlNode(doc, layerObj);
             layerNodes.AppendChild(layerNode);
             if (layerObj.SubNodes != null)
             {
                 foreach (PersistObject sub in layerObj.SubNodes)
                 {
                     PersistObjectToXmlNode(doc, layerNode, sub);
                 }
             }
             doc.Save(newFileName);
         }
     }
 }
        //调整一级子节点顺序
        public void AdjustOrder(int insertIndex, ILayerItem item)
        {
            ILayerItem parent = FindLayerParent(item);

            if (parent is ILayersProvider)
            {
                this.Items.Remove(item);
                this.Items.Insert(insertIndex, item);
                _viewer.LayoutHost.LayoutRuntime.Layout.Elements.Remove(item.Tag as IElement);
                _viewer.LayoutHost.LayoutRuntime.Layout.Elements.Insert(insertIndex, item.Tag as IElement);
                RefreshViewer();
            }
            else
            {
                AdjustOrder(insertIndex, item, parent);
            }
        }
Exemple #18
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (_helpers == null)
     {
         return;
     }
     foreach (ILayerItem it in _helpers.Keys)
     {
         if (_helpers[it].Bounds.Contains(e.Location))
         {
             _focusedItem = it;
             return;
         }
     }
     _focusedItem = null;
 }
Exemple #19
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     _focusedItem = null;
     if (_provider == null || _provider.Items == null || _provider.Items.Count == 0)
     {
         return;
     }
     FindFocusedLayer(e.Location, _provider);
     if (_focusedItem != null)
     {
         if (_helpers[_focusedItem].VisibleBounds.Contains(e.Location))
         {
             _focusedItem.IsVisible = !_focusedItem.IsVisible;
             SetAllChildrenVisible(_focusedItem, _focusedItem.IsVisible);
             _provider.RefreshViewer();
         }
         else if (_helpers[_focusedItem].EditBounds.Contains(e.Location) && _focusedItem.IsSelected)
         {
             _editLayerItem = _focusedItem;
             Invalidate();
             return;
         }
         else
         {
             if (_helpers[_focusedItem].GroupCollpaseBounds.Contains(e.Location))
             {
                 _helpers[_focusedItem].IsCollpased = !_helpers[_focusedItem].IsCollpased;
             }
         }
         if (_allowDrag && _focusedItem != null && !_helpers[_focusedItem].IsFixed)
         {
             Cursor         = dragCursor;
             _isDraging     = true;
             _dragLayerItem = _focusedItem;
             beginDrapPoint = e.Location;
         }
     }
     if (_textBox.Visible)
     {
         _textBox.Visible = false;
     }
     _currentLayerItem = _focusedItem;
     Invalidate();
 }
Exemple #20
0
        private Image GetImage(ILayerItem it)
        {
            if (it.Image != null)
            {
                return(it.Image);
            }
            switch (it.LayerType)
            {
            case enumLayerTypes.OrbitData:
                return(imageList.Images[6]);

            case enumLayerTypes.BaseVector:
                return(imageList.Images[7]);

            default:
                return(imageList.Images[cstUnknowIco]);
            }
        }
Exemple #21
0
 public ILayerItem FindParent(ILayerItem item)
 {
     foreach (ILayerItem layer in _items)
     {
         if (item.Equals(layer))
         {
             return(this);
         }
         if (layer is ILayerItemGroup)
         {
             ILayerItem parent = (layer as ILayerItemGroup).FindParent(item);
             if (parent != null)
             {
                 return(parent);
             }
         }
     }
     return(null);
 }
 public ILayerItem FindLayerParent(ILayerItem layer)
 {
     if (Items == null || Items.Count == 0)
     {
         return(null);
     }
     foreach (ILayerItem item in Items)
     {
         if (layer.Equals(item))
         {
             return(this);
         }
         if (item is ILayerItemGroup)
         {
             ILayerItem parent = (item as ILayerItemGroup).FindParent(layer);
             if (parent != null)
             {
                 return(parent);
             }
         }
     }
     return(null);
 }
Exemple #23
0
 public void SetLayerItemDown()
 {
     if (_currentLayerItem != null)
     {
         ILayerItem parent = FindLayerParent(_currentLayerItem);
         if (parent == null)
         {
             return;
         }
         int idx   = (parent as ILayerItemGroup).Items.IndexOf(_currentLayerItem);
         int count = (parent as ILayerItemGroup).Items.Count;
         idx = (idx + 1) >= count ? (count - 1) : ++idx;
         if (parent is ILayersProvider)
         {
             _provider.AdjustOrder(idx, _currentLayerItem);
         }
         else
         {
             _provider.AdjustOrder(idx, _currentLayerItem, parent);
         }
         Update();
     }
 }
 public ILayerItem FindParent(ILayerItem item)
 {
     throw new NotImplementedException();
 }
 public void Remove(ILayerItem item)
 {
     this.Items.Remove(item);
     _viewer.LayoutHost.LayoutRuntime.Layout.Elements.Remove(item.Tag as IElement);
     RefreshViewer();
 }
 public void Group(ILayerItem item, ILayerItemGroup group)
 {
     group.Items.Add(item);
 }
 public void Group(ILayerItem item, ILayerItemGroup group)
 {
 }
 public void AdjustOrder(int insertIndex, ILayerItem item, ILayerItem parentItem)
 {
 }
Exemple #29
0
        private void DrawLayerItem(Graphics g, ILayerItem item, ref int x, ref int y, ref int maxWidth)
        {
            if (item == null)
            {
                return;
            }
            int offsetLeft = 0;

            if (item is ILayerItemGroup)
            {
                if (!_helpers.ContainsKey(item))
                {
                    _helpers.Add(item, new ItemDrawHelper());
                }
                ItemDrawHelper helper = _helpers[item];
                helper.Bounds = new Rectangle(0, y, Width, cstGroupBarHeight);
                g.FillRectangle(groupFillBrush, helper.Bounds);
                g.DrawRectangle(Pens.Gray, helper.Bounds);
                g.DrawLine(Pens.Gray, x + cstVisibleBarWidth, y, x + cstVisibleBarWidth, y + cstGroupBarHeight);
                ILayerItem itemParent = FindLayerParent(item);
                if (itemParent != null && !_provider.Equals(itemParent))
                {
                    offsetLeft = GetOffsetLeft(item);
                }
                else if (_provider.Equals(itemParent))
                {
                    offsetLeft = cstFistItemLeftBank;
                }
                helper.GroupCollpaseBounds        = new Rectangle();
                helper.GroupCollpaseBounds.X      = offsetLeft + cstVisibleBarWidth;
                helper.GroupCollpaseBounds.Y      = y + cstGroupImageTopRemainBank;
                helper.GroupCollpaseBounds.Width  = imageList.Images[cstUpIco].Width;
                helper.GroupCollpaseBounds.Height = imageList.Images[cstUpIco].Height;
                if (helper.IsCollpased)
                {
                    g.DrawImage(imageList.Images[cstUpIco], helper.GroupCollpaseBounds.X, helper.GroupCollpaseBounds.Y);
                }
                else
                {
                    g.DrawImage(imageList.Images[cstDownIco], helper.GroupCollpaseBounds.X, helper.GroupCollpaseBounds.Y);
                }
                g.DrawImage(_groupImage, offsetLeft + cstVisibleBarWidth + 22, y + cstGroupImageTopRemainBank);
                helper.VisibleBounds        = new Rectangle();
                helper.VisibleBounds.X      = 4;
                helper.VisibleBounds.Y      = y + 6;
                helper.VisibleBounds.Width  = imageList.Images[cstEyeIcoOpen].Width;
                helper.VisibleBounds.Height = imageList.Images[cstEyeIcoOpen].Height;
                if (item.IsVisible)
                {
                    g.DrawImage(imageList.Images[cstEyeIcoOpen], helper.VisibleBounds.X, helper.VisibleBounds.Y);
                }
                else
                {
                    g.DrawImage(imageList.Images[cstEyeIcoClose], helper.VisibleBounds.X, helper.VisibleBounds.Y);
                }
                int beginX = offsetLeft + cstVisibleBarWidth + 42;
                if (item.Equals(_currentLayerItem))
                {
                    g.DrawString(item.Name, Font, Brushes.Gray, offsetLeft + cstVisibleBarWidth + 42, y + cstRemainBank);
                    if (maxWidth < g.MeasureString(item.Name, Font).Width)
                    {
                        maxWidth = (int)g.MeasureString(item.Name, Font).Width + beginX;
                    }
                }
                else
                {
                    g.DrawString(item.Name, Font, Brushes.Black, offsetLeft + cstVisibleBarWidth + 42, y + cstRemainBank);
                    if (maxWidth < g.MeasureString(item.Name, Font).Width)
                    {
                        maxWidth = (int)g.MeasureString(item.Name, Font).Width + beginX;
                    }
                }
                y += cstGroupBarHeight;
                if (!helper.IsCollpased)
                {
                    foreach (ILayerItem child in (item as ILayerItemGroup).Items)
                    {
                        DrawLayerItem(g, child, ref x, ref y, ref maxWidth);
                    }
                }
            }
            else
            {
                ILayerItem itemParent = FindLayerParent(item);
                if (itemParent != null && !_provider.Equals(itemParent))
                {
                    offsetLeft = GetOffsetLeft(item);
                }
                else if (_provider.Equals(itemParent))
                {
                    offsetLeft = cstFistItemLeftBank;
                }
                if (!_helpers.ContainsKey(item))
                {
                    _helpers.Add(item, new ItemDrawHelper());
                }
                ItemDrawHelper helper = _helpers[item];
                helper.Bounds        = new Rectangle();
                helper.Bounds.X      = 0;
                helper.Bounds.Y      = y;
                helper.Bounds.Width  = Width;
                helper.Bounds.Height = cstLayerItemHeight;
                g.DrawRectangle(Pens.Gray, helper.Bounds);
                g.DrawLine(Pens.Gray, x + cstVisibleBarWidth, y, x + cstVisibleBarWidth, y + cstGroupBarHeight);
                g.DrawImage(GetImage(item), offsetLeft + cstVisibleBarWidth, y + cstRemainBank, 16, 16);
                helper.VisibleBounds        = new Rectangle();
                helper.VisibleBounds.X      = 4;
                helper.VisibleBounds.Y      = y + cstRemainBank;
                helper.VisibleBounds.Width  = imageList.Images[cstEyeIcoOpen].Width;
                helper.VisibleBounds.Height = imageList.Images[cstEyeIcoOpen].Height;
                helper.EditBounds           = new Rectangle(helper.VisibleBounds.Right + 2, helper.VisibleBounds.Y, helper.VisibleBounds.Width, helper.VisibleBounds.Height);
                if (item.IsVisible)
                {
                    g.DrawImage(imageList.Images[cstEyeIcoOpen], helper.VisibleBounds.X, helper.VisibleBounds.Y);
                }
                else
                {
                    g.DrawImage(imageList.Images[cstEyeIcoClose], helper.VisibleBounds.X, helper.VisibleBounds.Y);
                }
                //if (_editLayerItem != null && item.Equals(_editLayerItem))
                //{
                //    g.DrawImage(imageList.Images[cstEditIco], helper.EditBounds.X, helper.EditBounds.Y);
                //}
                if (item.IsSelected)
                {
                    g.DrawImage(imageList.Images[cstEditIco], helper.EditBounds.X, helper.EditBounds.Y);
                }
                int beginX = offsetLeft + cstVisibleBarWidth + imageList.ImageSize.Width + 8;
                if (item.Equals(_currentLayerItem))
                {
                    g.DrawString(item.Name, Font, Brushes.Gray, offsetLeft + cstVisibleBarWidth + imageList.ImageSize.Width + 8, y + cstRemainBank + 2);
                    if (maxWidth < g.MeasureString(item.Name, Font).Width)
                    {
                        maxWidth = (int)g.MeasureString(item.Name, Font).Width + beginX;
                    }
                }
                else
                {
                    g.DrawString(item.Name, Font, Brushes.Black, offsetLeft + cstVisibleBarWidth + imageList.ImageSize.Width + 8, y + cstRemainBank + 2);
                    if (maxWidth < g.MeasureString(item.Name, Font).Width)
                    {
                        maxWidth = (int)g.MeasureString(item.Name, Font).Width + beginX;
                    }
                }
                y         += cstLayerItemHeight;
                offsetLeft = 0;
            }
        }