A new method for using PNG images in VB

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.