r/visualbasic • • Mar 06 '19

VB.NET Help How to use vector graphics (SVG) in VB.NET?

Can anyone help me figure out the best way to add vector graphics to a VB.NET program? I have a program with a series of buttons that I would like to replace with pictures. However the size of the button / picture changes during the execution so it seems better to use a vector format than a bitmap format for the images. We have created the pictures in Inkscape and are in SVG format, but can be converted to another format.

My questions:

  1. How can I display a vector image? Picturebox and Buttons seem to support bitmap only

  2. If I were to use a bitmap on a button (i.e. Button1.Image) is there anyway to have it dynamically resize? That is, if my bitmap is larger than the button, how can I make it so the image is resized so it fits perfectly to the button?

Thanks

7 Upvotes

2 comments sorted by

1

u/Bonejob VB Guru Mar 06 '19

https://github.com/vvvv/SVG

svg.net is the plugin you will need for working with SVG's in you application.

I use the above fork.

1

u/trab601 Mar 07 '19

Thank you.