het toevoegen van meedere images aan 1 picturebox en opslaan is niet zo moeilijk:
Visual Basic code: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Randomize() End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SaveFile As New SaveFileDialog Dim outputBMP As New Bitmap(PictureBox1.Image) Dim result As DialogResult = SaveFile.ShowDialog If result = Windows.Forms.DialogResult.OK Then outputBMP.Save(SaveFile.FileName & ".jpg", Drawing.Imaging.ImageFormat.Jpeg) End If End Sub Private Sub DrawImage() PictureBox1.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height) Dim g As Graphics = Graphics.FromImage(PictureBox1.Image) g.Clear(Color.White)
Dim Image1 As Image = New Bitmap("c:\img1.bmp") Dim Image2 As Image = New Bitmap("c:\img2.bmp") Dim Image3 As Image = New Bitmap("c:\img3.bmp") Dim Image4 As Image = New Bitmap("c:\img4.bmp")
g.DrawImage(Image1, CInt(Rnd() * PictureBox1.Width), CInt(Rnd() * PictureBox1.Height), Image1.Width, Image1.Height) g.DrawImage(Image2, CInt(Rnd() * PictureBox1.Width), CInt(Rnd() * PictureBox1.Height), Image1.Width, Image1.Height) g.DrawImage(Image3, CInt(Rnd() * PictureBox1.Width), CInt(Rnd() * PictureBox1.Height), Image1.Width, Image1.Height) g.DrawImage(Image4, CInt(Rnd() * PictureBox1.Width), CInt(Rnd() * PictureBox1.Height), Image1.Width, Image1.Height)
g.Flush() g.Dispose() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click DrawImage() End Sub End Class
Die rechtermuisknop vind ik wel interessant.. eens kijken of mij lukt omdat werkend te krijgen
[edit] Toch niet zo moeilijk als het klinkt:
Visual Basic code: Private Sub PictureBox1_RightMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick If e.Button = Windows.Forms.MouseButtons.Right Then ContextMenuStrip1.Show(PictureBox1, e.X, e.Y) End If End Sub
|