문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top