vb.net - Color-picker showing color names -
Detects For example, in Visual Studio, you can change the color of the control by using the Thank you! is too short for any of these unless you are VS With the designated colors, use it as a popup or some such example background as the background: If you set the DrawMode OwnerDrawFixed for You can do just window / VS Like the Swanchhak attracts, which defines a rectangle to fill. Generally, it is faster, but if you're doing something to define the background color, it helps to show how it looks with text and looks more color than a little stupid - Therefore the CBO item is filled. / P> The standard window text color will not be visible on all of them. For the "Light" theme, violet and black will hide / hide the name of the color will be impossible. then you can use it in the class from the combo box, y Build user control you want individual control. You can also leave it as a code in DLL which is called on those occasions. I should say that there are probably a dozen such crawlers on codepaceages. color-picker for any Visual Studio (Visual Basic) Shows standard colors?
color picker , which contains the
tab of "custom" ,
"web" and
"system" .
the web & amp;
System options show a list of color names, while
custom supplies (primarily) RGB (which controls VB color picture).
names the name of the private (_Colors) as the name of the string () to leave 'SystemColors leave the qualifiers Or 'need' function as the GetColorNames string (as for each) in the transparent colorName KnownColor.GetNames string (GetType (KnownColor)) as the _Colors.Add (colorName) end, then the next 'Post One CBO's name: cboBackColor.Items.AddRange (_Colors)
, then:
private sub cboSheetBackColor_DrawItem (ByVal as the object, ByVal e System.Windows.Forms.DrawItemEventArgs ) Colors such as the handle cboSheetBackColor.DrawItem dim Bclr, color as Fclr color for this item for this Bclr = Color.FromName (_Colors (e.Index) .toString) Fclr = GetContrastingColor (Bclr) Use 'e.Graphics to see below as new SolidBrush (Bclr). FillRectangle (br, e.bounds) as the use of br. New SolidBrush (Fclr) .DrawString (cboSheetBackColor.Items ( E.index ) .ToString, using cboShe br use etBackColor.Font, br, e.Bounds.X, e.Bounds.Y) e.DrawFocusRectangle () end end with end using the
GetContrastingColor is a function that evaluates the current color brightness and then returns either white or black:
public function GetContrastingColor (ByVal clrBase as the color ) Color then return color as Y ', otherwise the color of the return, "Brightness" will be double = (0.299 * clrBase.R) _ + (0.587 * clrBase.G) _ + (0.114 * clrBase). B) If (140 y and lt) is black end and end function
Comments
Post a Comment