From da14cc5ee7fbfbda26e3ee0c94054c3f74fb8d23 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 12 Nov 2005 22:56:37 +0000 Subject: Added ability to use Window Colour Dialog --- AlphaColourDialog.cs | 94 ++++++++++++++++++----------- BitmapSpriteEd.AlphaColourDialog.resources | Bin 0 -> 12343 bytes BitmapSpriteEd.prjx | 9 +-- 3 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 BitmapSpriteEd.AlphaColourDialog.resources diff --git a/AlphaColourDialog.cs b/AlphaColourDialog.cs index 1cecf40..a36b2de 100644 --- a/AlphaColourDialog.cs +++ b/AlphaColourDialog.cs @@ -29,15 +29,15 @@ namespace BitmapSpriteEd /// public class AlphaColourDialog : System.Windows.Forms.Form { - private System.Windows.Forms.Label m_common7; + private System.Windows.Forms.ComboBox m_named; private System.Windows.Forms.Label m_common4; - private System.Windows.Forms.Label m_common5; private System.Windows.Forms.Label m_common3; + private System.Windows.Forms.Label m_common5; private System.Windows.Forms.TextBox m_red; + private System.Windows.Forms.Label m_common7; private System.Windows.Forms.TrackBar m_greenSlider; private System.Windows.Forms.TextBox m_alpha; private System.Windows.Forms.Label m_preview; - private System.Windows.Forms.ComboBox m_named; private System.Windows.Forms.TrackBar m_redSlider; private System.Windows.Forms.TrackBar m_alphaSlider; private System.Windows.Forms.Label label1; @@ -150,15 +150,15 @@ namespace BitmapSpriteEd this.label1 = new System.Windows.Forms.Label(); this.m_alphaSlider = new System.Windows.Forms.TrackBar(); this.m_redSlider = new System.Windows.Forms.TrackBar(); - this.m_named = new System.Windows.Forms.ComboBox(); this.m_preview = new System.Windows.Forms.Label(); this.m_alpha = new System.Windows.Forms.TextBox(); this.m_greenSlider = new System.Windows.Forms.TrackBar(); + this.m_common7 = new System.Windows.Forms.Label(); this.m_red = new System.Windows.Forms.TextBox(); - this.m_common3 = new System.Windows.Forms.Label(); this.m_common5 = new System.Windows.Forms.Label(); + this.m_common3 = new System.Windows.Forms.Label(); this.m_common4 = new System.Windows.Forms.Label(); - this.m_common7 = new System.Windows.Forms.Label(); + this.m_named = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.m_blueSlider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_alphaSlider)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_redSlider)).BeginInit(); @@ -329,17 +329,6 @@ namespace BitmapSpriteEd this.m_redSlider.TickFrequency = 5; this.m_redSlider.Scroll += new System.EventHandler(this.OnRed); // - // m_named - // - this.m_named.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.m_named.Location = new System.Drawing.Point(8, 296); - this.m_named.MaxDropDownItems = 20; - this.m_named.Name = "m_named"; - this.m_named.Size = new System.Drawing.Size(168, 21); - this.m_named.Sorted = true; - this.m_named.TabIndex = 25; - this.m_named.SelectedIndexChanged += new System.EventHandler(this.OnNamedColour); - // // m_preview // this.m_preview.BackColor = System.Drawing.Color.Black; @@ -348,6 +337,9 @@ namespace BitmapSpriteEd this.m_preview.Name = "m_preview"; this.m_preview.Size = new System.Drawing.Size(168, 168); this.m_preview.TabIndex = 14; + this.m_preview.Text = "Click Here to use standard Windows Colour Picker"; + this.m_preview.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m_preview.Click += new System.EventHandler(this.OnSelectColour); // // m_alpha // @@ -370,6 +362,16 @@ namespace BitmapSpriteEd this.m_greenSlider.TickFrequency = 5; this.m_greenSlider.Scroll += new System.EventHandler(this.OnGreen); // + // m_common7 + // + this.m_common7.BackColor = System.Drawing.Color.Fuchsia; + this.m_common7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_common7.Location = new System.Drawing.Point(96, 240); + this.m_common7.Name = "m_common7"; + this.m_common7.Size = new System.Drawing.Size(24, 24); + this.m_common7.TabIndex = 22; + this.m_common7.Click += new System.EventHandler(this.OnCommon); + // // m_red // this.m_red.Location = new System.Drawing.Point(192, 296); @@ -380,16 +382,6 @@ namespace BitmapSpriteEd this.m_red.TabIndex = 8; this.m_red.Text = "textBox1"; // - // m_common3 - // - this.m_common3.BackColor = System.Drawing.Color.Red; - this.m_common3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_common3.Location = new System.Drawing.Point(96, 208); - this.m_common3.Name = "m_common3"; - this.m_common3.Size = new System.Drawing.Size(24, 24); - this.m_common3.TabIndex = 18; - this.m_common3.Click += new System.EventHandler(this.OnCommon); - // // m_common5 // this.m_common5.BackColor = System.Drawing.Color.Blue; @@ -400,6 +392,16 @@ namespace BitmapSpriteEd this.m_common5.TabIndex = 20; this.m_common5.Click += new System.EventHandler(this.OnCommon); // + // m_common3 + // + this.m_common3.BackColor = System.Drawing.Color.Red; + this.m_common3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_common3.Location = new System.Drawing.Point(96, 208); + this.m_common3.Name = "m_common3"; + this.m_common3.Size = new System.Drawing.Size(24, 24); + this.m_common3.TabIndex = 18; + this.m_common3.Click += new System.EventHandler(this.OnCommon); + // // m_common4 // this.m_common4.BackColor = System.Drawing.Color.Lime; @@ -410,15 +412,16 @@ namespace BitmapSpriteEd this.m_common4.TabIndex = 19; this.m_common4.Click += new System.EventHandler(this.OnCommon); // - // m_common7 + // m_named // - this.m_common7.BackColor = System.Drawing.Color.Fuchsia; - this.m_common7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_common7.Location = new System.Drawing.Point(96, 240); - this.m_common7.Name = "m_common7"; - this.m_common7.Size = new System.Drawing.Size(24, 24); - this.m_common7.TabIndex = 22; - this.m_common7.Click += new System.EventHandler(this.OnCommon); + this.m_named.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_named.Location = new System.Drawing.Point(8, 296); + this.m_named.MaxDropDownItems = 20; + this.m_named.Name = "m_named"; + this.m_named.Size = new System.Drawing.Size(168, 21); + this.m_named.Sorted = true; + this.m_named.TabIndex = 25; + this.m_named.SelectedIndexChanged += new System.EventHandler(this.OnNamedColour); // // AlphaColourDialog // @@ -505,5 +508,26 @@ namespace BitmapSpriteEd Color=Color.FromKnownColor((KnownColor)Enum.Parse(typeof(KnownColor),s)); } + void OnSelectColour(object sender, System.EventArgs e) + { + ColorDialog dlg=new ColorDialog(); + + dlg.Color=Color.FromArgb(m_alphaSlider.Value, + m_redSlider.Value, + m_greenSlider.Value, + m_blueSlider.Value); + + dlg.AnyColor=true; + dlg.SolidColorOnly=false; + dlg.FullOpen=true; + + if (dlg.ShowDialog()==DialogResult.OK) + { + m_redSlider.Value=dlg.Color.R; + m_greenSlider.Value=dlg.Color.G; + m_blueSlider.Value=dlg.Color.B; + SetColour(); + } + } } } diff --git a/BitmapSpriteEd.AlphaColourDialog.resources b/BitmapSpriteEd.AlphaColourDialog.resources new file mode 100644 index 0000000..06a8784 Binary files /dev/null and b/BitmapSpriteEd.AlphaColourDialog.resources differ diff --git a/BitmapSpriteEd.prjx b/BitmapSpriteEd.prjx index 2f22c95..2322055 100644 --- a/BitmapSpriteEd.prjx +++ b/BitmapSpriteEd.prjx @@ -12,15 +12,16 @@ + - - + + - + - + -- cgit v1.2.3