//Edit private void C_CustomStyle_Click(object sender, System.EventArgs e) { TreeNode node = this.C_AllStyles.SelectedNode; if (node == null) { return; } Styles.ExControlStyles style = node.Tag as Styles.ExControlStyles; if (style == null) { return; } this._CustomBuilderForm.BindStyles(style); if (this._CustomBuilderForm.ShowDialog(this) == DialogResult.OK) { if (this.C_AllStyles.SelectedNode.Index == 0) //current style node { return; } style.Save(this.GetStylesFilePath(style)); } if (node.Text == "Default") { style.Load(this.GetStylesFilePath(style)); } }
//Add private void C_AddStyle_Click(object sender, System.EventArgs e) { this.CreateStylesFolder(); Styles.ExControlStyles style = new Styles.ExControlStyles(); this._CustomBuilderForm.BindStyles(style); if (this._SaveFileDialog.ShowDialog(this) == DialogResult.OK) { style.StyleName = this._SaveFileDialog.FileName; string strFile = this.GetStylesFilePath(style.StyleName); if (System.IO.File.Exists(strFile)) { if (MessageBox.Show(this, "The style file is exist , do you want overwrite it?", "Warnning", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } style.Save(strFile); this.LoadStyles(style); } }
private void C_RenameStyle_Click(object sender, System.EventArgs e) { TreeNode node = this.C_AllStyles.SelectedNode; if (node == null) { return; } Styles.ExControlStyles style = node.Tag as Styles.ExControlStyles; if (style == null) { return; } string strOldFile = this.GetStylesFilePath(style.StyleName); if (this._SaveFileDialog.ShowDialog(this) == DialogResult.OK) { style.StyleName = this._SaveFileDialog.FileName; string strFile = this.GetStylesFilePath(style.StyleName); if (System.IO.File.Exists(strFile)) { MessageBox.Show("The style file is exist"); } else { System.IO.File.Delete(strOldFile); style.Save(strFile); this.LoadStyles(style); } } }