John Dann wrote:
On Sun, 18 Jun 2006 15:18:15 -0500, "Jay B. Harlow [MVP - Outlook]"
<Ja************@tsbradley.net> wrote:
Are you certain that VB is changing the value & not the control itself?
Many thanks for the comments. What I observe is that I can enter a
value of eg &HFFC0C0C0 as a parameter in a call to a method of the
charting control. As soon as I move the cursor out of that code line
in the VB2005 code editor then the value flicks back to &HC0C0C0.
This is why I referred to it as happening as a result of Intellisense.
But whether this behaviour is triggered by VB itself or perhaps by the
variable type exposed by the charting control for the parameter in
question is I'm afraid beyond me!
It actually changes the code you typed? That's unusual.
I would question the quality of any .NET charting control that didn't use
System.Drawing.Color to specify color values! As you should need to worry
about any "workarounds" or how to specify a color...
That's probably fair comment. It's actually a control called
ChartDirector (from www.advsofteng.com/).
OK I grabbed the trial version. First things first - as stated in their
docs, the ARGB format they expect has it's 'A' the other way round from
..NET:
"
The .NET framework has a class System.Drawing.Color used to represent
colors. However, its ARGB color representation is not compatible with
ChartDirector. For example, in System.Drawing.Color, the red color is
FFFF0000 instead of FF0000. The reason is because the alpha component
in .NET actually refers to opacity - the reverse of transparency as
used in ChartDirector.
"
So considering the solid grey color we are talking about
:
- In .NET, this color's .ToArgb is &HFFC0C0C0, with the FF representing
maximum *opacity*
- In HTML convention, this color would be &HC0C0C0, with the initial 00
representing zero *transparency*
This control wants its colors in HTML format, so anything like
&HFFxxxxxx would be completely *transparent*, so the xxxxxx would be
irrelevant. Again from the docs:
"
If alpha transparency is FF (255), the color is totally transparent.
That means the color is invisible. It does not matter what the RGB
components are. So in ChartDirector, only one totally transparent color
is used - FF000000. All other colors of the form FFnnnnnn are reserved
to represent palette colors and dynamic colors, and should not be
interpreted as the normal ARGB colors.
....
For convenience, ChartDirector pre-defines a constant called
Transparent, which is equivalent to FF000000.
"
So this explains the 'why' of it automatically changing the code you
write, when you try and pass &HFFC0C0C0. This is a 'special' value and
probably not what anyone typing it means, so it autocorrects it to
&HC0C0C0, which is probably what is meant. The 'how' is another
question, which isn't totally relevant so I haven't spent much time
looking into it.
I note finally from the docs the existence of helper functions
(Chart.CColor and Chart.NColor) to convert between the two different
color representations - these should be used for code clarity.
--
Larry Lard
Replies to group please