Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1594
| From | Schmidt <sss@online.de> |
|---|---|
| Newsgroups | microsoft.public.vb.general.discussion, comp.lang.basic.visual.misc |
| Subject | Re: Color names in color picker used in font common dialog |
| Date | 2012-10-09 16:05 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <k51avd$aci$1@dont-email.me> (permalink) |
| References | (2 earlier) <hke678hoho2q4j8n9jlcvlcecf4eke454p@4ax.com> <k4vg3j$tkh$1@dont-email.me> <prq678909dulqs5kieguigfgaa2mesnu9d@4ax.com> <k508pe$pn4$1@dont-email.me> <k5143f$vhs$1@dont-email.me> |
Cross-posted to 2 groups.
Am 09.10.2012 14:08, schrieb Norm Cook:
> Public Property Get NameByIndex$(ByVal ColorIdxZerobased As Long)
> NameByIndex = mColorNames(CStr(ColorIdxZerobased))
> End Property
>
> should be named ColorNameByIndex in order for
> ColorByIndex to compile.
>
Oops, yes - thanks - I've cobbled that class together a bit,
to simulate the features of a cCollection (which is the
host for this color-list in my SVG-parser).
The error should have become apparent, when I just
had used the right Test (in the lstColors_Click-event).
As originally posted, also the test doesn't make any sense.
Here the whole (corrected) thing again with a better test:
'***Into a Test-Form
Option Explicit
Private SVGColorMap As New cSVGColorMap, WithEvents lstColors As ListBox
Private Sub Form_Load()
Set lstColors = Controls.Add("VB.ListBox", "lstColors")
lstColors.Move 0, 0, ScaleWidth * 0.3, ScaleHeight
lstColors.Visible = True
Dim i As Long
For i = 0 To SVGColorMap.Count - 1
lstColors.AddItem SVGColorMap.NameByIndex(i)
Next i
End Sub
Private Sub lstColors_Click()
Caption = lstColors.Text
BackColor = SVGColorMap.ColorByName(lstColors.Text)
'just for control-purposes (to test the ColorByIndex-Property)
If BackColor <> SVGColorMap.ColorByIndex(lstColors.ListIndex) Then Stop
End Sub
'***into a Class cSVGColorMap
Option Explicit
Private mColorNames As Collection, mColorValues As Collection
Private Sub Class_Initialize()
Set mColorNames = New Collection
Set mColorValues = New Collection
InitSVGColorMap
End Sub
Public Sub Add(ColorName As String, ByVal ColorValue As Long)
mColorNames.Add ColorName, CStr(mColorNames.Count)
mColorValues.Add ColorValue, ColorName
End Sub
Public Property Get Count() As Long
Count = mColorValues.Count
End Property
Public Property Get ColorByName&(ColorName As String)
ColorByName = mColorValues(ColorName)
End Property
Public Property Get NameByIndex$(ByVal ColorIdxZerobased As Long)
NameByIndex = mColorNames(CStr(ColorIdxZerobased))
End Property
Public Property Get ColorByIndex&(ByVal ColorIdxZerobased As Long)
ColorByIndex = mColorValues(NameByIndex(ColorIdxZerobased))
End Property
Private Sub InitSVGColorMap()
Add "AliceBlue", RGB(239, 247, 255)
Add "AntiqueWhite", RGB(249, 234, 215)
Add "Aqua", RGB(0, 255, 255)
Add "Aquamarine", RGB(126, 255, 211)
Add "Azure", RGB(239, 255, 255)
Add "Beige", RGB(244, 244, 220)
Add "Bisque", RGB(255, 227, 196)
Add "Black", RGB(0, 0, 0)
Add "BlanchedAlmond", RGB(255, 234, 205)
Add "Blue", RGB(0, 0, 255)
Add "BlueViolet", RGB(137, 43, 226)
Add "Brown", RGB(165, 42, 42)
Add "BurlyWood", RGB(221, 183, 135)
Add "CadetBlue", RGB(94, 158, 160)
Add "Chartreuse", RGB(126, 255, 0)
Add "Chocolate", RGB(210, 104, 29)
Add "Coral", RGB(255, 126, 79)
Add "CornflowerBlue", RGB(99, 149, 237)
Add "Cornsilk", RGB(255, 247, 220)
Add "Crimson", RGB(220, 20, 59)
Add "Cyan", RGB(0, 255, 255)
Add "DarkBlue", RGB(0, 0, 138)
Add "DarkCyan", RGB(0, 138, 138)
Add "DarkGoldenrod", RGB(183, 133, 11)
Add "DarkGray", RGB(169, 169, 169)
Add "DarkGreen", RGB(0, 99, 0)
Add "DarkGrey", RGB(169, 169, 169)
Add "DarkKhaki", RGB(188, 182, 107)
Add "DarkMagenta", RGB(138, 0, 138)
Add "DarkOliveGreen", RGB(84, 107, 47)
Add "DarkOrange", RGB(255, 140, 0)
Add "DarkOrchid", RGB(183, 49, 204)
Add "DarkRed", RGB(138, 0, 0)
Add "DarkSalmon", RGB(232, 150, 122)
Add "DarkSeaGreen", RGB(142, 187, 142)
Add "DarkSlateBlue", RGB(72, 61, 138)
Add "DarkSlateGray", RGB(47, 79, 79)
Add "DarkSlateGrey", RGB(47, 79, 79)
Add "DarkTurquoise", RGB(0, 206, 209)
Add "DarkViolet", RGB(147, 0, 211)
Add "DeepPink", RGB(255, 20, 146)
Add "DeepSkyBlue", RGB(0, 191, 255)
Add "DimGray", RGB(104, 104, 104)
Add "DimGrey", RGB(104, 104, 104)
Add "DodgerBlue", RGB(29, 144, 255)
Add "FireBrick", RGB(177, 33, 33)
Add "FloralWhite", RGB(255, 249, 239)
Add "ForestGreen", RGB(33, 138, 33)
Add "Fuchsia", RGB(255, 0, 255)
Add "Gainsboro", RGB(220, 220, 220)
Add "GhostWhite", RGB(247, 247, 255)
Add "Gold", RGB(255, 215, 0)
Add "Goldenrod", RGB(218, 165, 31)
Add "Gray", RGB(127, 127, 127)
Add "Green", RGB(0, 127, 0)
Add "GreenYellow", RGB(173, 255, 47)
Add "Grey", RGB(127, 127, 127)
Add "Honeydew", RGB(239, 255, 239)
Add "HotPink", RGB(255, 104, 179)
Add "IndianRed", RGB(205, 91, 91)
Add "Indigo", RGB(74, 0, 130)
Add "Ivory", RGB(255, 255, 239)
Add "Khaki", RGB(239, 229, 140)
Add "Lavender", RGB(229, 229, 249)
Add "LavenderBlush", RGB(255, 239, 244)
Add "LawnGreen", RGB(124, 252, 0)
Add "LemonChiffon", RGB(255, 249, 205)
Add "LightBlue", RGB(173, 216, 229)
Add "LightCoral", RGB(239, 127, 127)
Add "LightCyan", RGB(224, 255, 255)
Add "LightGoldenrod", RGB(237, 221, 130)
Add "LightGoldenrodYellow", RGB(249, 249, 210)
Add "LightGray", RGB(211, 211, 211)
Add "LightGreen", RGB(144, 237, 144)
Add "LightGrey", RGB(211, 211, 211)
Add "LightPink", RGB(255, 181, 192)
Add "LightSalmon", RGB(255, 160, 122)
Add "LightSeaGreen", RGB(31, 177, 170)
Add "LightSkyBlue", RGB(135, 206, 249)
Add "LightSlateBlue", RGB(132, 112, 255)
Add "LightSlateGray", RGB(119, 135, 153)
Add "LightSlateGrey", RGB(119, 135, 153)
Add "LightSteelBlue", RGB(175, 196, 221)
Add "LightYellow", RGB(255, 255, 224)
Add "Lime", RGB(0, 255, 0)
Add "LimeGreen", RGB(49, 205, 49)
Add "Linen", RGB(249, 239, 229)
Add "Magenta", RGB(255, 0, 255)
Add "Maroon", RGB(127, 0, 0)
Add "MediumAquamarine", RGB(102, 205, 170)
Add "MediumBlue", RGB(0, 0, 205)
Add "MediumOrchid", RGB(186, 84, 211)
Add "MediumPurple", RGB(146, 112, 219)
Add "MediumSeaGreen", RGB(59, 178, 113)
Add "MediumSlateBlue", RGB(123, 104, 237)
Add "MediumSpringGreen", RGB(0, 249, 154)
Add "MediumTurquoise", RGB(72, 209, 204)
Add "MediumVioletRed", RGB(198, 21, 132)
Add "MidnightBlue", RGB(24, 24, 112)
Add "MintCream", RGB(244, 255, 249)
Add "MistyRose", RGB(255, 227, 225)
Add "Moccasin", RGB(255, 227, 181)
Add "NavajoWhite", RGB(255, 221, 173)
Add "Navy", RGB(0, 0, 127)
Add "NavyBlue", RGB(0, 0, 127)
Add "OldLace", RGB(252, 244, 229)
Add "Olive", RGB(127, 127, 0)
Add "OliveDrab", RGB(107, 141, 34)
Add "Orange", RGB(255, 165, 0)
Add "OrangeRed", RGB(255, 68, 0)
Add "Orchid", RGB(218, 112, 214)
Add "PaleGoldenrod", RGB(237, 232, 170)
Add "PaleGreen", RGB(151, 251, 151)
Add "PaleTurquoise", RGB(175, 237, 237)
Add "PaleVioletRed", RGB(219, 112, 146)
Add "PapayaWhip", RGB(255, 238, 212)
Add "PeachPuff", RGB(255, 218, 184)
Add "Peru", RGB(205, 132, 63)
Add "Pink", RGB(255, 191, 202)
Add "Plum", RGB(221, 160, 221)
Add "PowderBlue", RGB(175, 224, 229)
Add "Purple", RGB(127, 0, 127)
Add "Red", RGB(255, 0, 0)
Add "RosyBrown", RGB(187, 142, 142)
Add "RoyalBlue", RGB(65, 104, 225)
Add "SaddleBrown", RGB(138, 68, 19)
Add "Salmon", RGB(249, 127, 114)
Add "SandyBrown", RGB(243, 164, 95)
Add "SeaGreen", RGB(45, 138, 86)
Add "Seashell", RGB(255, 244, 237)
Add "Sienna", RGB(160, 81, 44)
Add "Silver", RGB(191, 191, 191)
Add "SkyBlue", RGB(135, 206, 234)
Add "SlateBlue", RGB(105, 89, 205)
Add "SlateGray", RGB(112, 127, 144)
Add "SlateGrey", RGB(112, 127, 144)
Add "Snow", RGB(255, 249, 249)
Add "SpringGreen", RGB(0, 255, 126)
Add "SteelBlue", RGB(70, 130, 179)
Add "Tan", RGB(210, 179, 140)
Add "Teal", RGB(0, 127, 127)
Add "Thistle", RGB(216, 191, 216)
Add "Tomato", RGB(255, 99, 71)
Add "Turquoise", RGB(63, 224, 207)
Add "Violet", RGB(237, 130, 237)
Add "VioletRed", RGB(208, 31, 144)
Add "Wheat", RGB(244, 221, 178)
Add "White", RGB(255, 255, 255)
Add "WhiteSmoke", RGB(244, 244, 244)
Add "Yellow", RGB(255, 255, 0)
Add "YellowGreen", RGB(154, 205, 49)
End Sub
Olaf
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-08 13:12 -0400
Re: Color names in color picker used in font common dialog "Jeff Johnson" <i.get@enough.spam> - 2012-10-08 14:07 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-08 16:47 -0400
Re: Color names in color picker used in font common dialog "Mayayana" <mayayana@invalid.nospam> - 2012-10-08 17:20 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-08 19:29 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-08 20:14 -0400
Re: Color names in color picker used in font common dialog Schmidt <sss@online.de> - 2012-10-09 06:21 +0200
Re: Color names in color picker used in font common dialog "Norm Cook" <normcook@cableone.net> - 2012-10-09 07:08 -0500
Re: Color names in color picker used in font common dialog Schmidt <sss@online.de> - 2012-10-09 16:05 +0200
Re: Color names in color picker used in font common dialog "Mayayana" <mayayana@invalid.nospam> - 2012-10-09 10:28 -0400
Re: Color names in color picker used in font common dialog "CoderX" <coder@x.com> - 2012-10-09 16:38 -0400
Re: Color names in color picker used in font common dialog Ulrich Korndoerfer <ulrich_wants_nospam@prosource.de> - 2012-10-09 23:05 +0200
Re: Color names in color picker used in font common dialog "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-10-08 22:42 +0100
Re: Color names in color picker used in font common dialog "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-10-08 22:49 +0100
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-08 20:15 -0400
Re: Color names in color picker used in font common dialog Deanna Earley <dee.earley@icode.co.uk> - 2012-10-09 09:30 +0100
Re: Color names in color picker used in font common dialog "Jeff Johnson" <i.get@enough.spam> - 2012-10-09 13:52 -0400
Re: Color names in color picker used in font common dialog "DaveO" <djo@dial.pipex.com> - 2012-10-09 11:57 +0100
Re: Color names in color picker used in font common dialog "DaveO" <djo@dial.pipex.com> - 2012-10-09 15:21 +0100
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-09 13:10 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-09 12:58 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-09 15:14 -0400
Re: Color names in color picker used in font common dialog "Mayayana" <mayayana@invalid.nospam> - 2012-10-09 17:33 -0400
Re: Color names in color picker used in font common dialog -mhd <not_real@invalid.com> - 2012-10-09 17:49 -0400
Re: Color names in color picker used in font common dialog Stan Weiss <srweiss@erols.com> - 2012-10-09 13:09 -0400
csiph-web