예제 #1
0
        private void ApplyDIBLayerSetting(Layer dibLayer, DIBSettings DIBSettingsObject)
        {
            try
            {
                if (dibLayer != null && DIBSettingsObject != null)
                {
                    DIBLayerSetting setting = DIBSettingsObject.GetDIBLayerSetting(dibLayer.LayerName);

                    if (setting != null)
                    {
                        dibLayer.FillColor = setting.FillColor;
                        dibLayer.FillStyle = setting.FillStyle;
                        dibLayer.BorderColor = setting.BorderColor;
                        dibLayer.BorderStyle = setting.BorderStyle;
                        dibLayer.BorderSize = setting.BorderWidth;
                    }
                }
            }
            catch
            {
            }
        }
예제 #2
0
        public void SaveDIBSettings(string DIBSettingsFilePath)
        {
            DIBSettings DIBSettingsObject = null;
            DIBLayerSetting LayerSetting = null;
            try
            {
                if (File.Exists(DIBSettingsFilePath))
                {
                    //- Load Previous DIB Settings.
                    DIBSettingsObject = DIBSettings.LoadDIBSettings(DIBSettingsFilePath);
                }
                else
                {
                    //- create new Object
                    DIBSettingsObject = new DIBSettings();
                }

                //- Update new DIB Settings from DIB layers
                foreach (Layer Lyr in this.m_Layers)
                {
                    if (Lyr.IsDIB)
                    {
                        LayerSetting = DIBSettingsObject.GetDIBLayerSetting(Lyr.LayerName);

                        //- If Previous DIBSettings DO NOT contains settings for this Layer
                        if (LayerSetting == null)
                        {
                            //- Add Settings for this Layer.
                            LayerSetting = new DIBLayerSetting();
                            DIBSettingsObject.DIBLayersSetting.Add(LayerSetting);
                        }

                        LayerSetting.LayerName = Lyr.LayerName;
                        LayerSetting.FillColor = Lyr.FillColor;
                        LayerSetting.FillStyle = Lyr.FillStyle;
                        LayerSetting.BorderColor = Lyr.BorderColor;
                        LayerSetting.BorderStyle = Lyr.BorderStyle;
                        LayerSetting.BorderWidth = Lyr.BorderSize;
                    }
                }

                //- Save XML settings
                DIBSettingsObject.Save(DIBSettingsFilePath);
            }
            catch
            {
            }
        }