asciipumper- mspaint style program to create irc ascii art |
git clone git://git.acid.vegas/asciipumper.git |
Log | Files | Refs | Archive | README |
ColorSelector.cs (5444B)
1 #region Copyright (c) 2007, PP4L Software 2 /************************************************************************************ 3 4 Copyright 2007, PP4L Software 5 Author: Lampiasis <lampiasis@dvolker.com> 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 21 '***********************************************************************************/ 22 #endregion 23 24 25 using System; 26 using System.Collections.Generic; 27 using System.ComponentModel; 28 using System.Drawing; 29 using System.Data; 30 using System.Text; 31 using System.Windows.Forms; 32 33 namespace AsciiPumper 34 { 35 public partial class ColorSelector : UserControl 36 { 37 public ColorSelector() 38 { 39 InitializeComponent(); 40 LoadColorPalette(new ColorPalette()); 41 } 42 43 public void LoadColorPalette(ColorPalette colors) 44 { 45 m_Colors = colors; 46 color0.BackColor = colors[0]; 47 color1.BackColor = colors[1]; 48 color2.BackColor = colors[2]; 49 color3.BackColor = colors[3]; 50 color4.BackColor = colors[4]; 51 color5.BackColor = colors[5]; 52 color6.BackColor = colors[6]; 53 color7.BackColor = colors[7]; 54 color8.BackColor = colors[8]; 55 color9.BackColor = colors[9]; 56 color10.BackColor = colors[10]; 57 color11.BackColor = colors[11]; 58 color12.BackColor = colors[12]; 59 color13.BackColor = colors[13]; 60 color14.BackColor = colors[14]; 61 color15.BackColor = colors[15]; 62 } 63 64 private ColorPalette m_Colors = new ColorPalette(); 65 66 /// <summary> 67 /// Gets or sets the Colors. 68 /// </summary> 69 public ColorPalette Colors 70 { 71 get { return m_Colors; } 72 set { LoadColorPalette(value); } 73 } 74 75 public class ButtonColorChangedEventArgs : EventArgs 76 { 77 public static readonly new ButtonColorChangedEventArgs Empty = new ButtonColorChangedEventArgs(0, new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0)); 78 79 public ButtonColorChangedEventArgs(byte colorindex, MouseEventArgs e ) 80 { 81 ColorIndex = colorindex; 82 MouseEvent = e; 83 } 84 85 public MouseEventArgs MouseEvent; 86 public byte ColorIndex; 87 } 88 89 public event EventHandler<ButtonColorChangedEventArgs> ButtonColorChanged; 90 91 protected virtual void OnButtonColorChanged(ButtonColorChangedEventArgs e) 92 { 93 EventHandler<ButtonColorChangedEventArgs> handler = ButtonColorChanged; 94 if (handler != null) 95 { 96 handler(this, e); 97 } 98 } 99 100 private void color0_MouseClick(object sender, MouseEventArgs e) 101 { 102 OnButtonColorChanged(new ButtonColorChangedEventArgs(0, e)); 103 104 } 105 106 private void color1_Click(object sender, EventArgs e) 107 { 108 109 } 110 111 private void color1_MouseClick(object sender, MouseEventArgs e) 112 { 113 OnButtonColorChanged(new ButtonColorChangedEventArgs(1, e)); 114 } 115 116 private void color2_MouseClick(object sender, MouseEventArgs e) 117 { 118 OnButtonColorChanged(new ButtonColorChangedEventArgs(2, e)); 119 } 120 121 private void color3_MouseClick(object sender, MouseEventArgs e) 122 { 123 OnButtonColorChanged(new ButtonColorChangedEventArgs(3, e)); 124 } 125 126 private void color4_MouseClick(object sender, MouseEventArgs e) 127 { 128 OnButtonColorChanged(new ButtonColorChangedEventArgs(4, e)); 129 } 130 131 private void color5_MouseClick(object sender, MouseEventArgs e) 132 { 133 OnButtonColorChanged(new ButtonColorChangedEventArgs(5, e)); 134 } 135 136 private void color6_MouseClick(object sender, MouseEventArgs e) 137 { 138 OnButtonColorChanged(new ButtonColorChangedEventArgs(6, e)); 139 } 140 141 private void color7_MouseClick(object sender, MouseEventArgs e) 142 { 143 OnButtonColorChanged(new ButtonColorChangedEventArgs(7, e)); 144 } 145 146 private void color8_MouseClick(object sender, MouseEventArgs e) 147 { 148 OnButtonColorChanged(new ButtonColorChangedEventArgs(8, e)); 149 } 150 151 private void color9_MouseClick(object sender, MouseEventArgs e) 152 { 153 OnButtonColorChanged(new ButtonColorChangedEventArgs(9, e)); 154 } 155 156 private void color10_MouseClick(object sender, MouseEventArgs e) 157 { 158 OnButtonColorChanged(new ButtonColorChangedEventArgs(10, e)); 159 } 160 161 private void color11_Click(object sender, EventArgs e) 162 { 163 164 } 165 166 private void color11_MouseClick(object sender, MouseEventArgs e) 167 { 168 OnButtonColorChanged(new ButtonColorChangedEventArgs(11, e)); 169 } 170 171 private void color12_MouseClick(object sender, MouseEventArgs e) 172 { 173 OnButtonColorChanged(new ButtonColorChangedEventArgs(12, e)); 174 } 175 176 private void color13_MouseClick(object sender, MouseEventArgs e) 177 { 178 OnButtonColorChanged(new ButtonColorChangedEventArgs(13, e)); 179 } 180 181 private void color14_MouseClick(object sender, MouseEventArgs e) 182 { 183 OnButtonColorChanged(new ButtonColorChangedEventArgs(14, e)); 184 } 185 186 private void color15_MouseClick(object sender, MouseEventArgs e) 187 { 188 OnButtonColorChanged(new ButtonColorChangedEventArgs(15, e)); 189 } 190 } 191 }