コード例 #1
0
        private void tslCurrentLayer_Click(object sender, EventArgs e)
        {
            LayerDialog ld = new LayerDialog(drawArea.TheLayers);

            ld.ShowDialog();
            // First add any new layers
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerNew)
                {
                    Layer layer = new Layer();
                    layer.LayerName = ld.layerList[i].LayerName;
                    layer.Graphics  = new GraphicsList();
                    drawArea.TheLayers.Add(layer);
                }
            }
            drawArea.TheLayers.InactivateAllLayers();
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerActive)
                {
                    drawArea.TheLayers.SetActiveLayer(i);
                }

                if (ld.layerList[i].LayerVisible)
                {
                    drawArea.TheLayers.MakeLayerVisible(i);
                }
                else
                {
                    drawArea.TheLayers.MakeLayerInvisible(i);
                }

                drawArea.TheLayers[i].LayerName = ld.layerList[i].LayerName;
            }
            // Lastly, remove any deleted layers
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerDeleted)
                {
                    drawArea.TheLayers.RemoveLayer(i);
                }
            }
            drawArea.Invalidate();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: bqIcelove/DrawTools
        private void tslCurrentLayer_Click(object sender, EventArgs e)
        {
            LayerDialog ld = new LayerDialog(drawArea.TheLayers);
            ld.ShowDialog();
            // First add any new layers
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerNew)
                {
                    Layer layer = new Layer();
                    layer.LayerName = ld.layerList[i].LayerName;
                    layer.Graphics = new GraphicsList();
                    drawArea.TheLayers.Add(layer);
                }
            }
            drawArea.TheLayers.InactivateAllLayers();
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerActive)
                    drawArea.TheLayers.SetActiveLayer(i);

                if (ld.layerList[i].LayerVisible)
                    drawArea.TheLayers.MakeLayerVisible(i);
                else
                    drawArea.TheLayers.MakeLayerInvisible(i);

                drawArea.TheLayers[i].LayerName = ld.layerList[i].LayerName;
            }
            // Lastly, remove any deleted layers
            for (int i = 0; i < ld.layerList.Count; i++)
            {
                if (ld.layerList[i].LayerDeleted)
                    drawArea.TheLayers.RemoveLayer(i);
            }
            drawArea.Invalidate();
        }