Draw Image(BMP, New Point(0, 0)) Dim hr Hand As Double = tick Sum Mod 43200 Dim min Hand As Double = tick Sum Mod 3600 Dim sec Hand As Double = tick Sum Mod 60 Dim radius As Integer = Form Center.
Y, CInt(x), CInt(y)) End Sub Private Sub my Timer_Tick(By Val sender As Object, By Val e As System.
Hi, I am building an app that uses around a hundred dynamic controls across 3 different views. It can become really time consuming and program intensive tp keep creating/destorying that many controls.
A clock is used to show how to draw the image background separately from the image components that need to be updated periodically. I cannot stop this being visible so have resorted to reducing the opacity to 0 create new controls and then increasing back to 1 (100%). All of the controls for these (Text Boxes, Labels etc are created dynamically when switching to each view so for exampleu a user switches from Agent view to Project view all Agent controls are destroyed and all Project controls created.I have a macro that runs for about a minute and loads/processes a lot of data.Naturally I've turned off screen updating so that it runs faster and doesn't jump around all the time.It involves creating the (relatively) static components of the display as a bitmap only when required, This is at startup and when the form size changes. Start() Draw Clock() End Sub Sub Draw Clock() BMP = New Bitmap(Me. This bitmap is then drawn to the display in the Paint event, and the dynamic components (the hour, minute and second hands) are drawn over the bitmap. This process reduces the load on the system when the display is updated frequently. This example does not require any design-time components. Draw Line(my Pen, CInt(x1), CInt(y1), CInt(x2), CInt(y2)) Next 'Draw the 12 hour positions. Draw Line(my Pen, CInt(x1), CInt(y1), CInt(x2), CInt(y2)) Next End Sub Private Sub Form1_Paint(By Val sender As Object, By Val e As System.