示例#1
0
        /**
         * Select a tool
         **/
        private void setCurrTool(Tool tool)
        {
            currTool = tool;

            setCurrEntity(null);
            setCurrEntityType(null);
            list.Items.Clear();
            imgList.Images.Clear();
            splitRight.Panel2Collapsed = true;

            if (tool == null)
            {
                return;
            }

            setPaintMode(null);

            int j = 0;

            foreach (EntityType type in tool.getTypes())
            {
                EntityTypeListItem itm = new EntityTypeListItem();
                itm.EntityType = type;
                list.Items.Add(itm);

                if (type.Image != null)
                {
                    imgList.Images.Add(type.Image);
                    itm.ImageIndex = j++;
                }
            }

            splitRight.Panel2Collapsed = (list.Items.Count < 2);

            if (list.Items.Count > 0)
            {
                list.Items[0].Selected = true;
                setCurrEntityType(((EntityTypeListItem)list.Items[0]).EntityType);
            }
        }
示例#2
0
        /**
         * Select a tool
         **/
        private void setCurrTool(Tool tool)
        {
            currTool = tool;

            setCurrEntity(null);
            setCurrEntityType(null);
            list.Items.Clear();
            imgList.Images.Clear();
            splitRight.Panel2Collapsed = true;

            if (tool == null) return;

            setPaintMode(null);

            int j = 0;
            foreach (EntityType type in tool.getTypes()) {
                EntityTypeListItem itm = new EntityTypeListItem();
                itm.EntityType = type;
                list.Items.Add(itm);

                if (type.Image != null) {
                    imgList.Images.Add(type.Image);
                    itm.ImageIndex = j++;
                }
            }

            splitRight.Panel2Collapsed = (list.Items.Count < 2);

            if (list.Items.Count > 0) {
                list.Items[0].Selected = true;
                setCurrEntityType(((EntityTypeListItem)list.Items[0]).EntityType);
            }
        }