05-12-20, 06:11 PM
اخي الكريم قمت بتنفيذ تجربة لقياس الوقت باستخدام labels و buttons لمعرفة ايهم يأخذ وقت اطول
انشأت فورم للازرار وفورم لليبلات وفورم فارغ للمقارنة
وضعت في كل فورم 224 اداه وقمت باستخدام Stopwatch لقياس الوقت بين انشاء الفورم وظهورة فعلا على الشاشة
وقمت في الفورم الرئيسي باستدعاء كل فورم منهم 10 مرات ، وكانت النتائج كما التالي :
الكود :
الفورم الرئيسي :
فورم الازرار :
فورم الليبلات :
انشأت فورم للازرار وفورم لليبلات وفورم فارغ للمقارنة
وضعت في كل فورم 224 اداه وقمت باستخدام Stopwatch لقياس الوقت بين انشاء الفورم وظهورة فعلا على الشاشة
وقمت في الفورم الرئيسي باستدعاء كل فورم منهم 10 مرات ، وكانت النتائج كما التالي :
إقتباس :اتضح ان الليبلات اسرع قليلا من الازرار ولكن الفرق ليس بالكبير ، فهنا قرارك هل تريد التخلي عن شكل الازارار وتأثير الضغط وكل ذلك ام لاMain Form Time : 4919buttonsForm Time : 388buttonsForm Time : 284buttonsForm Time : 275buttonsForm Time : 290buttonsForm Time : 300buttonsForm Time : 292buttonsForm Time : 280buttonsForm Time : 289buttonsForm Time : 271buttonsForm Time : 303LabelsForm Time : 381LabelsForm Time : 235LabelsForm Time : 257LabelsForm Time : 237LabelsForm Time : 233LabelsForm Time : 249LabelsForm Time : 239LabelsForm Time : 248LabelsForm Time : 251LabelsForm Time : 273
Empty Form Time : 13
Empty Form Time : 16
Empty Form Time : 16
Empty Form Time : 15
Empty Form Time : 16
Empty Form Time : 16
Empty Form Time : 17
Empty Form Time : 13
Empty Form Time : 18
Empty Form Time : 17
الكود :
الفورم الرئيسي :
كود :
Public Class Form1
Dim sw As New Stopwatch
Sub New()
sw.Start()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
sw.Stop()
Console.WriteLine("Main Form Time : " & sw.ElapsedMilliseconds)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim bf As New buttonsForm
bf.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim lf As New LabelsForm
lf.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ef As New EmptyForm
ef.Show()
End Sub
End Classفورم الازرار :
كود :
Public Class buttonsForm
Dim sw As New Stopwatch
Sub New()
sw.Start()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
sw.Stop()
Console.WriteLine("buttonsForm Time : " & sw.ElapsedMilliseconds)
End Sub
End Classفورم الليبلات :
كود :
Public Class LabelsForm
Dim sw As New Stopwatch
Sub New()
sw.Start()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
sw.Stop()
Console.WriteLine("LabelsForm Time : " & sw.ElapsedMilliseconds)
End Sub
End Class
