BleepingComputer.com: Saving an image boxes content as .png?

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Saving an image boxes content as .png? In VB 9

#1 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 07 June 2009 - 04:28 AM

Hi, I am creating a program for my dad that helps him do his job, he fills in all of the boxes and then it creates the appropriate forms for him, I made it so it outputted in HTML which works great, although this is easyly editable, I have come up with the idea of outputting it as a image (png to be more specific), i would have to create my own font and system etc but i am willing to do that, anyway i would load an image into an image box and use set pixel to manipulate an image, after this i would need to save that image as a png, is this possible? If not i did look into converting it to a pdf, this seems only achevable with a sdk, is there any other way?

Thank you, Wolfy87.

#2 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 07 June 2009 - 04:43 AM

ok, worked it out and refined the code a little, here it is for any people that want to know =)

Imports System.Drawing.Imaging

Public Class MainClass

	Private Sub MainClass_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim MyImage As New Bitmap(256, 256)
		Dim gr As Graphics = Graphics.FromImage(MyImage)
		gr.Clear(Color.White)
		gr.DrawEllipse(Pens.Red, 0, 0, MyImage.Width - 1, MyImage.Height - 1)
		gr.DrawLine(Pens.Green, 0, 0, MyImage.Width - 1, MyImage.Height - 1)
		gr.DrawLine(Pens.Blue, MyImage.Width - 1, 0, 0, MyImage.Height - 1)
		MyImage.Save("test.PNG", ImageFormat.Png)
		Me.Close()
	End Sub
End Class


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users