locked
Special force RRS feed

  • Question

  • Fast application?

    '

    '

    '

    '

    '

    '

    For y = 1 to me.height

    For x = 1 to me.width

            Me.CreateGraphics.DrawEllipse(Pens.Red, New Rectangle(10, 10, 1, 1))

    next

    next


    Allow time to reverse.

    • Moved by Reed KimbleMVP Monday, January 7, 2013 4:28 PM no specific question (From:Visual Basic)
    Monday, January 7, 2013 11:53 AM

Answers

  • Why draw same thing over and over, draw once

        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim sw As New Stopwatch
            Dim gr As Graphics = Me.CreateGraphics
            sw.Start()
            gr.DrawEllipse(Pens.Red, New Rectangle(100, 100, 10, 10))
            gr.Dispose()
            sw.Stop()
            TextBox1.Text = "done - " & (CDec(sw.ElapsedTicks / Stopwatch.Frequency)).ToString & " seconds"
        End Sub

    answer here is : done - 0.000896394182112599 seconds

    • Proposed as answer by Mr. Monkeyboy Monday, January 7, 2013 4:08 PM
    • Marked as answer by Abdu Rahman Tuesday, August 5, 2014 5:26 AM
    Monday, January 7, 2013 3:23 PM

All replies

  • Hi Abdu Rahman,

    can you explain what is the question?

    thanks!


    Ruggiero Lovreglio
    www.ruggierolovreglio.altervista.org

    Monday, January 7, 2013 12:18 PM
  • May be he wants to make fast application as the given code takes a long time!

    Do the Impossible

    Monday, January 7, 2013 12:24 PM
  • Why draw same thing over and over, draw once

        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim sw As New Stopwatch
            Dim gr As Graphics = Me.CreateGraphics
            sw.Start()
            gr.DrawEllipse(Pens.Red, New Rectangle(100, 100, 10, 10))
            gr.Dispose()
            sw.Stop()
            TextBox1.Text = "done - " & (CDec(sw.ElapsedTicks / Stopwatch.Frequency)).ToString & " seconds"
        End Sub

    answer here is : done - 0.000896394182112599 seconds

    • Proposed as answer by Mr. Monkeyboy Monday, January 7, 2013 4:08 PM
    • Marked as answer by Abdu Rahman Tuesday, August 5, 2014 5:26 AM
    Monday, January 7, 2013 3:23 PM