A
Andy Roxburgh
Hi,
I have an monitoring application that displays various pieces of data,
which are changing, on a tabpage within a form. The data is displayed
in various different colours and the various items are shown in
different positions on the form. It's a status panel basically.
I'm originally used labels to hold all the various bits of text.
I don't want to use labels because:
(1) I'm using the .Net Compact Framework which only allows around 100
controls before bombing out. I have multiple panels showing quite a
few labels.
(2) more importantly, it takes too long to draw on the screen. This is
a real-time monitoring application. With data conversions, it takes
around 300ms to draw about 20 floating-point data values and other
static text on the screen (I'm using WinCE on a Hitachi SH4
processor).
I was given this code snippet, which works great for the static pieces
of text (e.g. the data units, signal names etc), but if I use this
technique to display the changing data values, it means I have to
refresh the entire form (or tabpage in my case) every time. This is
too time-consuming.
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim f As Font
Dim b As Brush
Dim r As RectangleF
r = New RectangleF(5, 5, 200, 20)
f = New Font("Arial", 10, FontStyle.Bold)
b = New SolidBrush(Color.White)
e.Graphics.DrawString("Cabin Temperature", f, b, r)
End Sub
It appears when I do a TabPage1.Refresh() to redraw the tab page.
I could vastly improve the speed of things if I could draw the text
without having to refresh the whole page every time - I'm updating
around (on average) 10 times a second so if I repaint the whole form
it flickers and is quite slow.
Can anyone help me repaint individual pieces of text?
Any help appreciated.
Thanks
Andy
I have an monitoring application that displays various pieces of data,
which are changing, on a tabpage within a form. The data is displayed
in various different colours and the various items are shown in
different positions on the form. It's a status panel basically.
I'm originally used labels to hold all the various bits of text.
I don't want to use labels because:
(1) I'm using the .Net Compact Framework which only allows around 100
controls before bombing out. I have multiple panels showing quite a
few labels.
(2) more importantly, it takes too long to draw on the screen. This is
a real-time monitoring application. With data conversions, it takes
around 300ms to draw about 20 floating-point data values and other
static text on the screen (I'm using WinCE on a Hitachi SH4
processor).
I was given this code snippet, which works great for the static pieces
of text (e.g. the data units, signal names etc), but if I use this
technique to display the changing data values, it means I have to
refresh the entire form (or tabpage in my case) every time. This is
too time-consuming.
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim f As Font
Dim b As Brush
Dim r As RectangleF
r = New RectangleF(5, 5, 200, 20)
f = New Font("Arial", 10, FontStyle.Bold)
b = New SolidBrush(Color.White)
e.Graphics.DrawString("Cabin Temperature", f, b, r)
End Sub
It appears when I do a TabPage1.Refresh() to redraw the tab page.
I could vastly improve the speed of things if I could draw the text
without having to refresh the whole page every time - I'm updating
around (on average) 10 times a second so if I repaint the whole form
it flickers and is quite slow.
Can anyone help me repaint individual pieces of text?
Any help appreciated.
Thanks
Andy