vb.netvb6vb6-migration

VB6 Color code to VB.NET color conversion


I am trying to convert VB6 windows forms to VB.NET forms. Now the issue is about the Color conversion. In VB6 colors codes are like HH00400040 ,H00000000 ,etc. How to convert these codes to color options available for VB.NET.Not getting any idea on these.


Solution

  • VB6 stores RGB color in an Int32 and assigns first byte for Blue, second for green and third for red. so you can convert int32 to bytes and use appropriate byte for rgb colors as arguments.
    or easily use Color.FromArgb(Integer) method.