TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Derstine Buyagan
NA
11
866
Getting a Color Value from a ComboBox
Jun 21 2016 9:13 PM
Hi everyone, i do have a problem since last night. I am trying to pass a value from a combobox which contains some color values like "BLUE", "CYAN", "RED" and so on. I hope you don't mind if i will try to paste some code here as this is a third party product hoping you can help me out of here.<br /> <br /><div> I have an object SOLIDBRUSH which accepts a color parameter like </div><div> </div><div><strong style="color: #ff0000;"> <code>SolidBrush(Color.Aqua)</code> </strong></div><div> </div><div>so.<br /> So what i am trying to do now is to pass my combobox value like this</div><div> </div><div><strong><code style="color: #ff0000;">SolidBrush(combobox1.selectedItem)</code> </strong></div><div> </div><div> </div><div>To better understand my situation, let me post what the SolidBrush class contains, and what the Color class contains as well<br /> <br /> SOLIDBRUSH CLASS</div><div> </div><div><div class="dp-highlighter"><ol class="dp-c" start="1"><li class="alt"><span><span class="keyword">using</span><span> System; </span></span></li><li class=""><span>06 <span class="keyword">using</span><span> WebSupergoo.ABCpdf10.Drawing; </span></span></li><li class="alt"><span>07 </span></li><li class=""><span>08 <span class="keyword">namespace</span><span> WebSupergoo.ABCpdf10.Drawing </span></span></li><li class="alt"><span>09 { </span></li><li class=""><span>10 <span class="keyword">public</span><span> </span><span class="keyword">interface</span><span> Brush </span></span></li><li class="alt"><span>11 { </span></li><li class=""><span>12 Color Color { <span class="keyword">get</span><span>; </span><span class="keyword">set</span><span>; } </span></span></li><li class="alt"><span>13 </span></li><li class=""><span>14 } </span></li><li class="alt"><span>15 } </span></li><li class=""><span>16 </span></li><li class="alt"><span>17 #region SolidBrush </span></li><li class=""><span>18 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>19 <span class="comment">/// Used to fill the interiors of graphical shapes such as rectangles, ellipses, pies, polygons, and paths.</span><span> </span></span></li><li class=""><span>20 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>21 <span class="keyword">public</span><span> </span><span class="keyword">sealed</span><span> </span><span class="keyword">class</span><span> SolidBrush : Brush { </span></span></li><li class=""><span>22 #region Declare variables </span></li><li class="alt"><span>23 Color _color; </span></li><li class=""><span>24 </span></li><li class="alt"><span>25 #endregion </span></li><li class=""><span>26 </span></li><li class="alt"><span>27 #region Properties </span></li><li class=""><span>28 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>29 <span class="comment">/// Gets or sets the color of this Brush object. </span><span> </span></span></li><li class=""><span>30 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>31 <span class="keyword">public</span><span> Color Color { </span></span></li><li class=""><span>32 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> _color; } </span></span></li><li class="alt"><span>33 <span class="keyword">set</span><span> { _color = value; } </span></span></li><li class=""><span>34 } </span></li><li class="alt"><span>35 #endregion </span></li><li class=""><span>36 </span></li><li class="alt"><span>37 #region Constructors </span></li><li class=""><span>38 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>39 <span class="comment">/// Initializes a new instance of the Brush class with</span><span> </span></span></li><li class=""><span>40 <span class="comment">/// the specified Color property.</span><span> </span></span></li><li class="alt"><span>41 <span class="comment">/// </summary></span><span> </span></span></li><li class=""><span>42 <span class="comment">/// <param name="color">The color of this System.Drawing.Pen object.</param></span><span> </span></span></li><li class="alt"><span>43 <span class="keyword">public</span><span> SolidBrush(Color color) { </span></span></li><li class=""><span>44 _color = color; </span></li><li class="alt"><span>45 } </span></li><li class=""><span>46 </span></li><li class="alt"><span>47 #endregion </span></li><li class=""><span>48 </span></li><li class="alt"><span>49 <span class="keyword">public</span><span> </span><span class="keyword">override</span><span> </span><span class="keyword">bool</span><span> Equals(</span><span class="keyword">object</span><span> obj) { </span></span></li><li class=""><span>50 Brush b = obj <span class="keyword">as</span><span> Brush; </span></span></li><li class="alt"><span>51 <span class="keyword">if</span><span> (b != </span><span class="keyword">null</span><span>) </span></span></li><li class=""><span>52 <span class="keyword">return</span><span> b.Color.Equals(Color); </span></span></li><li class="alt"><span>53 <span class="keyword">else</span><span> </span></span></li><li class=""><span>54 <span class="keyword">return</span><span> </span><span class="keyword">false</span><span>; </span></span></li><li class="alt"><span>55 } </span></li><li class=""><span>56 </span></li><li class="alt"><span>57 <span class="keyword">public</span><span> </span><span class="keyword">override</span><span> </span><span class="keyword">int</span><span> GetHashCode() { </span></span></li><li class=""><span>58 <span class="keyword">return</span><span> </span><span class="keyword">base</span><span>.GetHashCode (); </span></span></li><li class="alt"><span>59 } </span></li><li class=""><span>60 } </span></li><li class="alt"><span>61 #endregion <br /></span></li></ol></div> COLOR CLASS</div><div><div class="dp-highlighter"><ol class="dp-c" start="1"><li class="alt"><span><span class="keyword">using</span><span> System; </span></span></li><li class=""><span>006 </span></li><li class="alt"><span>007 <span class="keyword">namespace</span><span> WebSupergoo.ABCpdf10.Drawing { </span></span></li><li class=""><span>008 #region Color </span></li><li class="alt"><span>009 <span class="comment">/// <summary></span><span> </span></span></li><li class=""><span>010 <span class="comment">/// A color in RGB, CMYK or Grayscale.</span><span> </span></span></li><li class="alt"><span>011 <span class="comment">/// </summary></span><span> </span></span></li><li class=""><span>012 <span class="keyword">public</span><span> </span><span class="keyword">class</span><span> Color { </span></span></li><li class="alt"><span>013 #region Declare variables </span></li><li class=""><span>014 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> a = 1; </span></span></li><li class="alt"><span>015 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> r = 0; </span></span></li><li class=""><span>016 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> g = 0; </span></span></li><li class="alt"><span>017 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> b = 0; </span></span></li><li class=""><span>018 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> c = 0; </span></span></li><li class="alt"><span>019 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> m = 0; </span></span></li><li class=""><span>020 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> y = 0; </span></span></li><li class="alt"><span>021 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> k = 0; </span></span></li><li class=""><span>022 <span class="keyword">internal</span><span> </span><span class="keyword">double</span><span> gray = 0; </span></span></li><li class="alt"><span>023 #endregion </span></li><li class=""><span>024 </span></li><li class="alt"><span>025 #region Properties </span></li><li class=""><span>026 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>027 <span class="comment">/// Gets or sets the alpha component.</span><span> </span></span></li><li class=""><span>028 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>029 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> A { </span></span></li><li class=""><span>030 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> a; } </span></span></li><li class="alt"><span>031 <span class="keyword">set</span><span> { a = value; } </span></span></li><li class=""><span>032 } </span></li><li class="alt"><span>033 </span></li><li class=""><span>034 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>035 <span class="comment">/// Gets or sets the red component.</span><span> </span></span></li><li class=""><span>036 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>037 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> R { </span></span></li><li class=""><span>038 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> r; } </span></span></li><li class="alt"><span>039 <span class="keyword">set</span><span> { r = value; } </span></span></li><li class=""><span>040 } </span></li><li class="alt"><span>041 </span></li><li class=""><span>042 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>043 <span class="comment">/// Gets or sets the green component.</span><span> </span></span></li><li class=""><span>044 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>045 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> G { </span></span></li><li class=""><span>046 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> g; } </span></span></li><li class="alt"><span>047 <span class="keyword">set</span><span> { g = value; } </span></span></li><li class=""><span>048 } </span></li><li class="alt"><span>049 </span></li><li class=""><span>050 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>051 <span class="comment">/// Gets or sets the blue component.</span><span> </span></span></li><li class=""><span>052 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>053 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> B { </span></span></li><li class=""><span>054 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> b; } </span></span></li><li class="alt"><span>055 <span class="keyword">set</span><span> { b = value; } </span></span></li><li class=""><span>056 } </span></li><li class="alt"><span>057 </span></li><li class=""><span>058 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>059 <span class="comment">/// Gets or sets the cyan component.</span><span> </span></span></li><li class=""><span>060 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>061 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> C { </span></span></li><li class=""><span>062 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> c; } </span></span></li><li class="alt"><span>063 <span class="keyword">set</span><span> { c = value; } </span></span></li><li class=""><span>064 } </span></li><li class="alt"><span>065 </span></li><li class=""><span>066 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>067 <span class="comment">/// Gets or sets the magenta component.</span><span> </span></span></li><li class=""><span>068 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>069 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> M { </span></span></li><li class=""><span>070 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> m; } </span></span></li><li class="alt"><span>071 <span class="keyword">set</span><span> { m = value; } </span></span></li><li class=""><span>072 } </span></li><li class="alt"><span>073 </span></li><li class=""><span>074 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>075 <span class="comment">/// Gets or sets the yellow component.</span><span> </span></span></li><li class=""><span>076 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>077 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> Y { </span></span></li><li class=""><span>078 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> y; } </span></span></li><li class="alt"><span>079 <span class="keyword">set</span><span> { y = value; } </span></span></li><li class=""><span>080 } </span></li><li class="alt"><span>081 </span></li><li class=""><span>082 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>083 <span class="comment">/// Gets or sets the black component.</span><span> </span></span></li><li class=""><span>084 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>085 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> K { </span></span></li><li class=""><span>086 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> k; } </span></span></li><li class="alt"><span>087 <span class="keyword">set</span><span> { k = value; } </span></span></li><li class=""><span>088 } </span></li><li class="alt"><span>089 </span></li><li class=""><span>090 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>091 <span class="comment">/// Gets or sets the gray level.</span><span> </span></span></li><li class=""><span>092 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>093 <span class="keyword">public</span><span> </span><span class="keyword">double</span><span> GrayScale { </span></span></li><li class=""><span>094 <span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> gray; } </span></span></li><li class="alt"><span>095 <span class="keyword">set</span><span> { gray = value; } </span></span></li><li class=""><span>096 } </span></li><li class="alt"><span>097 #endregion </span></li><li class=""><span>098 </span></li><li class="alt"><span>099 <span class="keyword">public</span><span> </span><span class="keyword">override</span><span> </span><span class="keyword">bool</span><span> Equals(</span><span class="keyword">object</span><span> obj) { </span></span></li><li class=""><span>100 Color c = obj <span class="keyword">as</span><span> Color; </span></span></li><li class="alt"><span>101 <span class="keyword">if</span><span> (c != </span><span class="keyword">null</span><span>) </span></span></li><li class=""><span>102 <span class="keyword">return</span><span> (A == c.A) && (R == c.R) && (G == c.G) && (B == c.B)/>/>; </span></span></li><li class="alt"><span>103 <span class="keyword">else</span><span> </span></span></li><li class=""><span>104 <span class="keyword">return</span><span> </span><span class="keyword">false</span><span>; </span></span></li><li class="alt"><span>105 } </span></li><li class=""><span>106 </span></li><li class="alt"><span>107 <span class="keyword">public</span><span> </span><span class="keyword">override</span><span> </span><span class="keyword">int</span><span> GetHashCode() { </span></span></li><li class=""><span>108 <span class="keyword">return</span><span> </span><span class="keyword">base</span><span>.GetHashCode (); </span></span></li><li class="alt"><span>109 } </span></li><li class=""><span>110 </span></li><li class="alt"><span>111 #region Static methods </span></li><li class=""><span>112 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>113 <span class="comment">/// Creates a Color from the specified 8-bit color values</span><span> </span></span></li><li class=""><span>114 <span class="comment">/// (red, green, and blue). The alpha value is implicitly 255 (fully opaque).</span><span> </span></span></li><li class="alt"><span>115 <span class="comment">/// </summary></span><span> </span></span></li><li class=""><span>116 <span class="comment">/// <param name="red">The red component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class="alt"><span>117 <span class="comment">/// <param name="green">The green component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class=""><span>118 <span class="comment">/// <param name="blue">The blue component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class="alt"><span>119 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class=""><span>120 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromArgb(</span><span class="keyword">int</span><span> red, </span><span class="keyword">int</span><span> green, </span><span class="keyword">int</span><span> blue) { </span></span></li><li class="alt"><span>121 <span class="keyword">return</span><span> FromArgb(255, red, green, blue); </span></span></li><li class=""><span>122 } </span></li><li class="alt"><span>123 </span></li><li class=""><span>124 </span></li><li class="alt"><span>125 </span></li><li class=""><span>126 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>127 <span class="comment">/// Creates a Color from a 32-bit ARGB value.</span><span> </span></span></li><li class=""><span>128 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>129 <span class="comment">/// <param name="argb">A value specifying the 32-bit ARGB value.</param></span><span> </span></span></li><li class=""><span>130 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class="alt"><span>131 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromArgb(</span><span class="keyword">int</span><span> argb) { </span></span></li><li class=""><span>132 System.Drawing.Color clr = System.Drawing.Color.FromArgb(argb); </span></li><li class="alt"><span>133 <span class="keyword">return</span><span> FromArgb(clr.A, clr.R, clr.G, clr.B)/>/>; </span></span></li><li class=""><span>134 } </span></li><li class="alt"><span>135 </span></li><li class=""><span>136 </span></li><li class="alt"><span>137 </span></li><li class=""><span>138 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>139 <span class="comment">/// Creates a Color from the specified pre-defined color.</span><span> </span></span></li><li class=""><span>140 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>141 <span class="comment">/// <param name="color">An element of the System.Drawing.KnownColor enumeration.</param></span><span> </span></span></li><li class=""><span>142 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class="alt"><span>143 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromKnownColor(System.Drawing.KnownColor color) { </span></span></li><li class=""><span>144 System.Drawing.Color sysColor = System.Drawing.Color.FromKnownColor(color); </span></li><li class="alt"><span>145 <span class="keyword">return</span><span> FromArgb(sysColor.A, sysColor.R, sysColor.G, sysColor.B)/>/>; </span></span></li><li class=""><span>146 } </span></li><li class="alt"><span>147 </span></li><li class=""><span>148 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>149 <span class="comment">/// Creates a Color from the specified System.Drawing.Color structure,</span><span> </span></span></li><li class=""><span>150 <span class="comment">/// but with the new specified alpha value.</span><span> </span></span></li><li class="alt"><span>151 <span class="comment">/// </summary></span><span> </span></span></li><li class=""><span>152 <span class="comment">/// <param name="alpha">The alpha value for the new System.Drawing.Color structure. Valid values are 0 through 255.</param></span><span> </span></span></li><li class="alt"><span>153 <span class="comment">/// <param name="baseColor">The System.Drawing.Color structure from which to create the new System.Drawing.Color structure.</param></span><span> </span></span></li><li class=""><span>154 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class="alt"><span>155 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromArgb(</span><span class="keyword">int</span><span> alpha, System.Drawing.Color baseColor) { </span></span></li><li class=""><span>156 <span class="keyword">return</span><span> FromArgb(alpha, baseColor.R, baseColor.G, baseColor.B)/>/>; </span></span></li><li class="alt"><span>157 } </span></li><li class=""><span>158 </span></li><li class="alt"><span>159 <span class="comment">/// <summary></span><span> </span></span></li><li class=""><span>160 <span class="comment">/// Creates a Color from the specified 8-bit RGB color values</span><span> </span></span></li><li class="alt"><span>161 <span class="comment">/// (alpha, red, green, and blue).</span><span> </span></span></li><li class=""><span>162 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>163 <span class="comment">/// <param name="alpha">The alpha component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class=""><span>164 <span class="comment">/// <param name="red">The red component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class="alt"><span>165 <span class="comment">/// <param name="green">The green component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class=""><span>166 <span class="comment">/// <param name="blue">The blue component value. Valid values are 0 through 255.</param></span><span> </span></span></li><li class="alt"><span>167 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class=""><span>168 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromArgb(</span><span class="keyword">int</span><span> alpha, </span><span class="keyword">int</span><span> red, </span><span class="keyword">int</span><span> green, </span><span class="keyword">int</span><span> blue) { </span></span></li><li class="alt"><span>169 Color clr = <span class="keyword">new</span><span> Color(); </span></span></li><li class=""><span>170 clr.a = alpha / 255F; </span></li><li class="alt"><span>171 clr.r = red / 255F; </span></li><li class=""><span>172 clr.g = green / 255F; </span></li><li class="alt"><span>173 clr.b = blue / 255F; </span></li><li class=""><span>174 <span class="keyword">return</span><span> clr; </span></span></li><li class="alt"><span>175 } </span></li><li class=""><span>176 </span></li><li class="alt"><span>177 <span class="comment">/// <summary></span><span> </span></span></li><li class=""><span>178 <span class="comment">/// Creates a Color from the specified ARGB color values</span><span> </span></span></li><li class="alt"><span>179 <span class="comment">/// (alpha, red, green, and blue).</span><span> </span></span></li><li class=""><span>180 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>181 <span class="comment">/// <param name="cyan">The alpha component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class=""><span>182 <span class="comment">/// <param name="magenta">The red component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class="alt"><span>183 <span class="comment">/// <param name="yellow">The green component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class=""><span>184 <span class="comment">/// <param name="black">The blue component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class="alt"><span>185 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class=""><span>186 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromArgb(</span><span class="keyword">double</span><span> alpha, </span><span class="keyword">double</span><span> red, </span><span class="keyword">double</span><span> green, </span><span class="keyword">double</span><span> blue) { </span></span></li><li class="alt"><span>187 Color clr = <span class="keyword">new</span><span> Color(); </span></span></li><li class=""><span>188 clr.a = alpha; </span></li><li class="alt"><span>189 clr.r = red; </span></li><li class=""><span>190 clr.g = green; </span></li><li class="alt"><span>191 clr.b = blue; </span></li><li class=""><span>192 <span class="keyword">return</span><span> clr; </span></span></li><li class="alt"><span>193 } </span></li><li class=""><span>194 </span></li><li class="alt"><span>195 <span class="comment">/// <summary></span><span> </span></span></li><li class=""><span>196 <span class="comment">/// Creates a Color from the specified CMYK color values</span><span> </span></span></li><li class="alt"><span>197 <span class="comment">/// (cyan, magenta, yellow, and black).</span><span> </span></span></li><li class=""><span>198 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>199 <span class="comment">/// <param name="cyan">The cyan component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class=""><span>200 <span class="comment">/// <param name="magenta">The magenta component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class="alt"><span>201 <span class="comment">/// <param name="yellow">The yellow component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class=""><span>202 <span class="comment">/// <param name="black">The black component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class="alt"><span>203 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class=""><span>204 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromCmyk(</span><span class="keyword">double</span><span> cyan, </span><span class="keyword">double</span><span> magenta, </span><span class="keyword">double</span><span> yellow, </span><span class="keyword">double</span><span> black) { </span></span></li><li class="alt"><span>205 Color clr = <span class="keyword">new</span><span> Color(); </span></span></li><li class=""><span>206 clr.c = cyan; </span></li><li class="alt"><span>207 clr.m = magenta; </span></li><li class=""><span>208 clr.y = yellow; </span></li><li class="alt"><span>209 clr.k = black; </span></li><li class=""><span>210 <span class="keyword">return</span><span> clr; </span></span></li><li class="alt"><span>211 } </span></li><li class=""><span>212 </span></li><li class="alt"><span>213 <span class="comment">/// <summary></span><span> </span></span></li><li class=""><span>214 <span class="comment">/// Creates a Color from the specified gray level.</span><span> </span></span></li><li class="alt"><span>215 <span class="comment">/// </summary></span><span> </span></span></li><li class=""><span>216 <span class="comment">/// <param name="gray">The gray component. Valid values are 0 through 1.</param></span><span> </span></span></li><li class="alt"><span>217 <span class="comment">/// <returns>The Color that this method creates.</returns></span><span> </span></span></li><li class=""><span>218 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color FromCmyk(</span><span class="keyword">double</span><span> gray) { </span></span></li><li class="alt"><span>219 Color clr = <span class="keyword">new</span><span> Color(); </span></span></li><li class=""><span>220 clr.gray = gray; </span></li><li class="alt"><span>221 <span class="keyword">return</span><span> clr; </span></span></li><li class=""><span>222 } </span></li><li class="alt"><span>223 </span></li><li class=""><span>224 <span class="comment">/// <summary></span><span> </span></span></li><li class="alt"><span>225 <span class="comment">/// Gets a system defined color</span><span> </span></span></li><li class=""><span>226 <span class="comment">/// </summary></span><span> </span></span></li><li class="alt"><span>227 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color AliceBlue { </span><span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> FromKnownColor(System.Drawing.KnownColor.AliceBlue); } } </span></span></li><li class=""><span>228 <span class="keyword">public</span><span> </span><span class="keyword">static</span><span> Color Yellow { </span><span class="keyword">get</span><span> { </span><span class="keyword">return</span><span> FromKnownColor(System.Drawing.KnownColor.Yellow); } } </span></span></li><li class="alt"><span>229 </span></li><li class=""><span>230 LIST of colors goes on.. <br /></span></li></ol></div> </div><div> Thanks</div><div> </div>
Reply
Answers (
3
)
Deploy windows form c# with local database
Extract required text from Word document using C#