Skip to content

Commit 5c14b54

Browse files
author
brahn
committedJun 4, 2011
This library is used by the SetTheme addin.
SOURCE: http://paletteselectors.codeplex.com/ I am pretty sure that the license allows me to include it in this project, if you have any issues please let me know!
1 parent 2346d34 commit 5c14b54

21 files changed

+1761
-0
lines changed
 
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System.ComponentModel;
2+
using System.Drawing.Design;
3+
using System.Text;
4+
using System.Windows.Forms;
5+
using ComponentFactory.Krypton.Toolkit;
6+
7+
namespace UserControls.Krypton.PaletteSelectors
8+
{
9+
public class CustomPalette
10+
{
11+
private ToolStripRenderMode _renderMode = ToolStripRenderMode.ManagerRenderMode;
12+
13+
[Category("Custom Palette")]
14+
[DisplayName("Display Name")]
15+
[Description("The display name for the custom palette.")]
16+
public string DisplayName { get; set; }
17+
18+
[Category("Custom Palette")]
19+
[DisplayName("Palette XML")]
20+
[Description("The XML markup for the custom palette.")]
21+
[Editor(typeof(CustomPaletteXmlEditor), typeof(UITypeEditor))]
22+
public string PaletteXml { get; set; }
23+
24+
[Category("Custom Palette")]
25+
[DisplayName("Render Mode")]
26+
[Description("The render mode to use if linked to a StatusStrip.")]
27+
[DefaultValue(ToolStripRenderMode.ManagerRenderMode)]
28+
public ToolStripRenderMode RenderMode
29+
{
30+
get { return _renderMode; }
31+
set { _renderMode = value; }
32+
}
33+
34+
[Browsable(false)]
35+
public KryptonPalette Palette
36+
{
37+
get
38+
{
39+
var palette = new KryptonPalette();
40+
palette.Import(Encoding.Default.GetBytes(PaletteXml));
41+
return palette;
42+
}
43+
}
44+
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections;
2+
3+
namespace UserControls.Krypton.PaletteSelectors
4+
{
5+
public class CustomPaletteCollection: CollectionBase
6+
{
7+
public CustomPalette this[int index]
8+
{
9+
get { return (CustomPalette)List[index]; }
10+
}
11+
12+
public void Add(CustomPalette palette)
13+
{
14+
List.Add(palette);
15+
}
16+
17+
public void Remove(CustomPalette palette)
18+
{
19+
List.Remove(palette);
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.ComponentModel.Design;
3+
4+
namespace UserControls.Krypton.PaletteSelectors
5+
{
6+
public class CustomPaletteCollectionEditor : CollectionEditor
7+
{
8+
public CustomPaletteCollectionEditor(Type type)
9+
: base(type)
10+
{}
11+
12+
protected override bool CanSelectMultipleInstances()
13+
{
14+
return false;
15+
}
16+
17+
protected override Type CreateCollectionItemType()
18+
{
19+
return typeof(CustomPalette);
20+
}
21+
22+
protected override string GetDisplayText(object value)
23+
{
24+
CustomPalette palette = (CustomPalette)value;
25+
return base.GetDisplayText(palette.DisplayName);
26+
}
27+
}
28+
}

‎Krypton.PaletteSelectors/CustomPaletteXmlDialog.Designer.cs

+114
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.IO;
3+
using System.Windows.Forms;
4+
5+
namespace UserControls.Krypton.PaletteSelectors
6+
{
7+
public partial class CustomPaletteXmlDialog : Form
8+
{
9+
public CustomPaletteXmlDialog()
10+
{
11+
InitializeComponent();
12+
}
13+
14+
private void okButton_Click(object sender, EventArgs e)
15+
{
16+
Close();
17+
}
18+
19+
private void cancelButton_Click(object sender, EventArgs e)
20+
{
21+
Close();
22+
}
23+
24+
private void loadPallete_Click(object sender, EventArgs e)
25+
{
26+
if (paletteFileDialog.ShowDialog() != DialogResult.OK) return;
27+
var path = paletteFileDialog.FileName;
28+
paletteXml.Text = File.ReadAllText(path);
29+
}
30+
31+
public CustomPaletteXmlDialog(string value)
32+
{
33+
if (!string.IsNullOrEmpty(value)) paletteXml.Text = value;
34+
}
35+
36+
37+
38+
}
39+
}

0 commit comments

Comments
 (0)
Please sign in to comment.