Okay, here you go. I can't explain the code, since I'm not familiar with .NET and have just cobbled this together using the
ode code copied from here:
How to: Create a Bitmap at Run Time[
^]
I have a form, with one button and one PictureBox. It's called PictureBox1a
Public Class Form1
Private pictureBox1 As New PictureBox()
Dim flag As New Bitmap(200, 100)
Public Sub CreateBitmapAtRuntime()
PictureBox1a.Size = New Size(210, 110)
Me.Controls.Add(PictureBox1a)
Dim flagGraphics As Graphics = Graphics.FromImage(flag)
Dim red As Integer = 0
Dim white As Integer = 11
While white <= 100
flagGraphics.FillRectangle(Brushes.Blue, 0, red, 200, 10)
flagGraphics.FillRectangle(Brushes.White, 0, white, 200, 10)
red += 20
white += 20
End While
PictureBox1a.Image = flag
End Sub
Private Sub copyBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles copyBtn.Click
CreateBitmapAtRuntime()
Clipboard.SetImage(flag)
End Sub
End Class
Hitting Ctrl-Shift-V(paste as new image) in Gimp gives me the freshly drawn image.