Frage

I try to migrate a code from VB6 to VB.NET.

I wanted to get the integer value of vbGreen in VB.NET.

In VB6 "vbGreen" relates to 65280. Now when I do

ColorTranslator.ToOle(Color.Green)

... it returns 32768.

Does anybody see where I go wrong?

Thank you!

War es hilfreich?

Lösung

65280 == &H00FF00 or 256 for green
32768 == &H008000 or 128 for green

And OLE color is BGR, the reverse from System.Drawing.Color which is RGB. Makes no difference here. Pretty clear what you did and forgot to say, you are using Color.Green. Which is not the same color as vbGreen. You should use Color.Lime instead. Note how the hex value of the color is displayed in the IntelliSense tip.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top