コード例 #1
0
        /// <summary>
        /// Serializes the list of color schemes to XML file
        /// </summary>
        private void btnOk_Click(object sender, EventArgs e)
        {
            ColorBlend blend = (ColorBlend)_schemes[0];
            Color      clr   = blend.Colors[0];

            _schemes.Clear();

            // dummy color scheme for shapefile
            if (_colorSchemes.Type == ColorSchemeType.Layer)
            {
                blend           = new ColorBlend(2);
                blend.Colors[0] = clr; blend.Positions[0] = 0.0f;
                blend.Colors[1] = clr; blend.Positions[1] = 1.0f;
                _schemes.Add(blend);
            }

            //int index = (_colorSchemes.Type == ColorSchemeType.Layer) ? 1 : 0;
            int index = 0;

            for (int i = index; i < listBox1.Items.Count; i++)
            {
                blend = (ColorBlend)listBox1.Items[i];
                if (blend != null)
                {
                    _schemes.Add(blend);
                }
            }

            // saving schemes
            _colorSchemes.Serialize2Xml();
        }