1. Ok. If you have different static bitmaps that you want to display, then you could just set the BackgroundImage of the form to that image, when you change it, rather than draw it. That will make the updating easier, i.e. you won't have to redraw the background in the paint event, and all the foreground dynamic parts will have been erased waiting for you to update them inside the Paint Event.
You could also load each static bitmap in its own picturebox and have only the one that is currently active visible. Again, update all the dynamic portions in each paint event.
2. Ok. In the example I'm posting, I loaded a single bitmap with the 10 digits in it, and when the example loads, I divided the single bitmap into 10 smaller single digit bitmaps. I did this to save me the time of having to create 10 single bitmaps in a paint program offline, but in the end uses multiple small bitmaps as you would.
3. As mentioned in 1 (above), you have options. If you want to only draw the static image once, to avoid complications you would need to maintain a bitmap image in memory to work with, as your static buffer. But if would be easier to take advantage of the built in capability of the Picture or Form to maintain that static image by assigning the image to the Background Image of the Form, or the Image property of a picturebox. That way, whenever you invalidate the control, the Paint event is triggered and you have a fresh copy of the static image to draw on, without the previous things you've drawn on the background. You just draw all the dynamic stuff in the paint event and you're done.
If you don't want to do it this way, and would rather maintain a static image in memory, and update it ad hoc, perhaps in parts without redoing all the dynamic stuff every pass, then that is another approach that can be done, but would take more explanation.
4. Redrawing boolean already covered above. Not needed if you assign the image to the control.
As for the dynamic image being a circle and showing the background through the circle, it depends on the image format. In order to see the background within the rectangle of the image, the image would have to contain transparent pixels, i.e. the pixels are defined by four values, alpha, red, green and blue values. if the alpha is 0, then the pixel will not be drawn so you would see the pixel "underneath". If the Alpha is 255 the color is opaque so you see the color from your image. Any value from 1 to 254, and you see a mixture of the pixel from the image and the pixel "underneath", 1 is almost all of the underneath pixel and 254 is almost all of the image pixels, and 128 would be an even mixture of the two.
5. System.Drawing.Drawing2D is a standard .Net library so available in all the .Net versions.
6. I'm sure there are many graphic libraries available. I have only used what is built into .Net, so accessible from VB and C# and other languages using the .Net Frameworks.
7. If the Dynamic Data isn't being generated by the VB program itself, then I've mostly used Ethernet with UDP, but also TCP where it is required by the device (rare). I've also used Serial with some devices. For UDP I've just the UDPClient class available in .Net and for Serial, the SerialPort component.
Now, for the example, I made it pretty simple. I just increment a counter that counts from 0000 to 9999 and display the value on the form, using the bitmap images of the digits. I didn't create convenient classes, or subs to manage the digits display at a more abstract level as that would be more code and you sound like you would like to look at as little code as possible. No scaling, no tranforms or translates, just simple draw this bitmap at an x,y location on the form.
I removed the border from the form, and set the bounds to 0, 0, 1024, 768 so it will display in the upper left corner of the monitor if you monitor is larger than that.
I added code so you can double click on the form, or hit the escape key to close it.
As mentioned, I have a bitmap in the resources with all 10 digits (in two rows), so the first task in the Load event handler is two loops to clone an area around each of the five digit in each row and create small bitmaps from them, assigned to an array so they can be access by digit number.
The timer is started and it simply increments a counter, keeping it in the range 0 to 9999, and it invalidates the form.
The invalidation causes the Paint Event to happen, and the paint event loops backward through each of the four digits of the counter and displays the digit on the form.
It loops backwards as it is a little less code to isolate the digits one at a time going from least significant digit to the most significant.
I didn't add a background image to the form. You can add an image to the BackgroundImage property in the Properties window of the IDE for the form, and see the digits being drawn on the background image.
Here is what the code looks like, but I'll attach the project so you have the digits bitmap included in the project resource and can run that project (again using VS2010, but should load and run fine in the later versions).
Code:
Public Class Form1
Private Counter As Integer
Private DigitBmps(9) As Bitmap
Private Sub Form1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.Escape Then Me.Close()
End Sub
Private Sub Form1_MouseDoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDoubleClick
Me.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.Bounds = New Rectangle(0, 0, 1024, 768)
Dim rect As New Rectangle(8, 0, 32, 42)
DoubleBuffered = True
For i As Integer = 0 To 4
DigitBmps(i) = My.Resources.SegmentedDigits.Clone(rect, Imaging.PixelFormat.Format32bppArgb)
rect.X += 33
Next
rect.X = 8 : rect.Y = 43
For i As Integer = 5 To 9
DigitBmps(i) = My.Resources.SegmentedDigits.Clone(rect, Imaging.PixelFormat.Format32bppArgb)
rect.X += 33
Next
Timer1.Interval = 100
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Counter += 1
Counter = Counter Mod 10000 'only count 0 to 9999
Invalidate()
End Sub
Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
Dim digit As Integer
Dim digits As Integer = Counter
Dim x As Integer = 300
Dim y As Integer = 100
For i As Integer = 3 To 0 Step -1
digit = digits Mod 10
digits = digits \ 10
g.DrawImage(DigitBmps(digit), x, y)
x = x - 32
Next
End Sub
End Class
p.s. To see a few more readouts in action, I modified the paint to do a nested loop, row and column, to do 5 columns by 11 rows of the readouts. After you've played around with the original project, perhaps you want to see how it runs when it is drawing 220 digit images 10 times per second on the form.
Code:
Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
Dim digit As Integer
Dim digits As Integer = Counter
Dim x As Integer = 300
Dim y As Integer = 100
For row = 100 To 600 Step 50
For col As Integer = 200 To 1000 Step 180
x = col : y = row
digits = (Counter + row + col) Mod 10000
For i As Integer = 3 To 0 Step -1
digit = digits Mod 10
digits = digits \ 10
g.DrawImage(DigitBmps(digit), x, y)
x = x - 32
Next
Next
Next
End Sub
Also, since I have a large screen and I would like to move the example form around, I used this code to allow me to drag the form out of the upper left corner.
Code:
Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Static lpos As Point
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Location += New Size(e.X - lpos.X, e.Y - lpos.Y)
Else
lpos = e.Location
End If
End Sub