Beispiel #1
0
        private ILineSymbol CreateNewSymbol(int type)
        {
            ILineSymbol simpleLineSymbolClass = null;

            switch (type)
            {
            case 0:
            {
                simpleLineSymbolClass = new SimpleLineSymbolClass();
                break;
            }

            case 1:
            {
                simpleLineSymbolClass = new CartographicLineSymbolClass();
                break;
            }

            case 2:
            {
                simpleLineSymbolClass = new MarkerLineSymbolClass();
                break;
            }

            case 3:
            {
                simpleLineSymbolClass = new HashLineSymbolClass();
                break;
            }

            case 4:
            {
                simpleLineSymbolClass = new PictureLineSymbolClass();
                break;
            }

            case 5:
            {
                simpleLineSymbolClass = new SimpleLine3DSymbolClass();
                break;
            }

            case 6:
            {
                simpleLineSymbolClass = new TextureLineSymbolClass();
                break;
            }
            }
            return(simpleLineSymbolClass);
        }
Beispiel #2
0
        //HashLineSymbol
        private void button9_Click(object sender, EventArgs e)
        {
            IHashLineSymbol hashLineSymbol = new HashLineSymbolClass();
            ILineProperties lineProperties = hashLineSymbol as ILineProperties;

            lineProperties.Offset = 0;
            double[] dob = new double[6];
            dob[0] = 0;
            dob[1] = 1;
            dob[2] = 2;
            dob[3] = 3;
            dob[4] = 4;
            dob[5] = 5;
            ITemplate template = new TemplateClass();

            template.Interval = 1;
            for (int i = 0; i < dob.Length; i += 2)
            {
                template.AddPatternElement(dob[i], dob[i + 1]);
            }
            lineProperties.Template = template;

            hashLineSymbol.Width = 2;
            hashLineSymbol.Angle = 45;
            IRgbColor hashColor = new RgbColor();

            hashColor            = getRGB(0, 0, 255);
            hashLineSymbol.Color = hashColor;

            IPolyline polyline = new PolylineClass();
            IPoint    point    = new PointClass();

            point.PutCoords(1, 1);
            polyline.FromPoint = point;
            point.PutCoords(10, 10);
            polyline.ToPoint = point;
            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(hashLineSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolyline(polyline as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
            activeView.ScreenDisplay.FinishDrawing();
        }