The image control and picture control in VB cannot directly load images in PNG format, which makes it difficult for us to use or browse images in PNG format. The current solutions are as follows:
(1) Use GDI to display PNG images;
(2) Make a PNG image into a SWF file and display it with the flash control.
The first method works well, but it is somewhat complicated. The second method is not only complicated, but it is no longer a PNG image. In fact, PNG images can be directly displayed in the webbrowser control. The Code is as follows: View plaincopy to clipboardprint?
Private sub commandementclick ()
On Error goto errline
Commondialog1.showopen
Webbrowser1.navigate2 commondialog1.filename
Errline:
End sub
Private sub form_load ()
Webbrowser1.navigate "about: blank"
Commondialog1.filter = "PNG Image (*. PNG) | *. PNG"
End sub
Private sub commandementclick ()
On Error goto errline
Commondialog1.showopen
Webbrowser1.navigate2 commondialog1.filename
Errline:
End sub
Private sub form_load ()
Webbrowser1.navigate "about: blank"
Commondialog1.filter = "PNG Image (*. PNG) | *. PNG"
End sub
In this way, you can view images in PNG format on your computer at will.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/SYSSZ/archive/2009/06/03/4240062.aspx