|
|
Default Form Background Colour |
|
Author |
Message |
Escimo

|
Posted: Visual Basic Express Edition, Default Form Background Colour |
Top |
Hello, I'm relatively new to coding and have stumbled across e.graphics. My question is, if i use e.graphics.clear, what is th default background colour for the form Will I have to make my own colour and if so, what are the argb values Is There an easier way
Visual Studio Express Editions43
|
|
|
|
 |
nobugz

|
Posted: Visual Basic Express Edition, Default Form Background Colour |
Top |
Use either of these:
gr.Clear(Me.BackColor) '--- Preferred
gr.Clear(Color.FromKnownColor(KnownColor.Control))
|
|
|
|
 |
Escimo

|
Posted: Visual Basic Express Edition, Default Form Background Colour |
Top |
Just to fill you in a bit more, i'm using e.graphics.drawstring(blah blah blah etc...) and animated it by changing the x and y locations. My code at the moment looks like this:
Public Class form1
Dim paints As System.Drawing.Graphics = Me.CreateGraphics
Dim afont As New System.Drawing.Font("Arial", 12)
Dim arctic As String = "Arctic Games Programming"
Dim x As Integer = -180
Dim y As Integer = 10
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
'Label1.Text = (arctic)
'Label1.Size = New Size(18, 10)
'Label1.Font = New Font("Arial", 10)
paints.DrawString(arctic, afont, Brushes.Black, (x + 5), y)
x = x + 1
paints.Clear( Me.BackColor)
'Label1.Location = New Point(x, y)
If x > 300 Then
x = -180
End If
End Sub
End Class
'But all the refresh things I've tried are really slow (I get it flashing for less than a second as it scrolls past)
|
|
|
|
 |
nobugz

|
Posted: Visual Basic Express Edition, Default Form Background Colour |
Top |
Put
the Clear() call before the DrawString() call and it will work a lot
better. There is still a bit of flashing, it will take removing
Clear() to solve that (hint: draw over the old text).
|
|
|
|
 |
|
|