VB Migration Partner

KNOWLEDGE BASE - Forms and controls

Previous | Index | Next 

[PRB] Image controls whose Picture property is Nothing aren't transparent

In VB6, an Image control whose Picture property is Nothing has a transparent background: you can see "through" it but the Image control still receives mouse events. This technique is often used by VB6 developers to create clickable "hot spots" over a form or a background image. In this case, the Image's BorderStyle property is usually set to 0-None, in which case the Image control becomes invisible, even though it receives mouse events.

The problem in converting these controls is that .NET doesn't support Image controls with transparent background. Setting the control's Visible property to False doesn't help, because an invisible .NET control doesn't receive mouse events.

VB Migration Partner solves the problem and converts the application correctly by setting the Image control's Visible property to False and manually forwarding all mouse events to the Image control. However, it is important to bear in mind that this arrangement works only if the BorderStyle property is also set to 0-None.

This trick doesn’t work if the Image control’s BorderStyle property is set to 1-FixedSingle. For example, a VB6 application might use such a control to draw a frame around a rectangular area on a form. In this case, the converted VB.NET displays a "blank" but opaque Image control that hides what is under it. Unfortunately, there is no definitive solution to this issue, even though the following two "half-solutions" should work in the majority of cases.

  1. If the application doesn't need to detect mouse activity over the Image control you can replace this control – in the original VB6 program – with a rectangular Shape control whose BorderWidth property is set to 1 or 2 pixels.
  2. If the application does need to detect mouse activity over the Image control, you can manually copy the underlying pixels to the Image.Picture property, for example using a PaintPicture method.
Previous | Index | Next 

Follow Francesco Balena on VB6 migration’s group on


Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.

Code Architects and its partners offers remote and onsite migration services.

More details

Subscribe to our free newsletter for useful VB6 migration tips and techniques.


To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice

A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial

The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote

Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers