You can download a working project. Below are VB code snippets showing how you might do these tasks.
’load a bitmap from an embedded resource
Dim Bmp As Bitmap
’ from an embedded resource
Dim curName As String = ''BitmapVB.sync.bmp''
Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream(curName)
Bmp = New Bitmap(strm)
PictureBox1.Image = Bmp
.....
.....
’load a bitmap from a file
Dim Bmp As Bitmap = Image.FromFile(''c:\sync.bmp'')
PictureBox1.Image = Bmp
.....
.....
’modify a bitmap
Dim Bmp As Bitmap = PictureBox1.Image.Clone
Dim g As Graphics = Graphics.FromImage(Bmp)
Dim brush1 As SolidBrush = New SolidBrush(Color.Red)
g.DrawString(TextBox1.Text, TextBox1.Font, brush1, 10, 10)
PictureBox2.Image = Bmp
g.Dispose()
....
....
’save a bitmap as a file
Dim dlg As SaveFileDialog = New SaveFileDialog()
dlg.Title = ''Save BMP file''
dlg.InitialDirectory = ''c:\''
dlg.Filter = ''bmp files (*.bmp)|*.bmp|All files (*.*)|*.*''
If dlg.ShowDialog = DialogResult.OK Then
PictureBox2.Image.Save(dlg.FileName
End If
Share with