تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] [تم الحل] انشاء المسارات وتمرير البارامترات لها وقت التشغيل
#3
(02-09-22, 06:03 AM)سعود كتب : صباح الخير
هل يمكن ام لاSmile

صباح الأنوار

أظن يمكن ..
وصلت لجزء من فكرة الحل .. ووقفت ..
وهذا هو الجزء .. 
أفتح مشروع جديد وضع عليه زر واحد ..

ثم أفتح محرر الاكود لنافذة وضع فيها هذا الكود ..
كود :
Dim pTop As Integer = 4

   Private Location_control As New Point(10, 50)
   Dim i1 As Integer
   Private Sub ALL(pC1 As Control(,))

       Dim pProgressBar As ProgressBar = CType(pC1(0, i1), ProgressBar)
       Dim pLabel As Label = CType(pC1(1, i1), Label)

       For i As Integer = 1 To 100
           pProgressBar.Invoke(Sub() pProgressBar.Value = i)
           pLabel.Invoke(Sub() pLabel.Text = pProgressBar.Value)
           Threading.Thread.Sleep(150)

       Next
   End Sub

   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
       Dim TA As Threading.Thread() = New Threading.Thread(3) {}
       Dim C(1, 3) As Control
       Dim pProgress As ProgressBar() = New ProgressBar(3) {}
       Dim lLable As Label() = New Label(3) {}

       Dim i As Integer

       For i = 0 To 3
           i1 = i
           '  TA(i) = New Threading.Thread(AddressOf ALL)
           C(0, i) = pProgress(i)
           pProgress(i) = New ProgressBar
           pProgress(i).Name = "pProgressX" & i
           pProgress(i).Location = New Point(Location_control.X + 10, Location_control.Y)
           pProgress(i).Width = Me.Width - 100
           pProgress(i).Height = 20
           pProgress(i).Minimum = 0
           pProgress(i).Maximum = 100
           pProgress(i).Value = 25
           Location_control.Y += 10
           Controls.Add(pProgress(i))


           C(1, i) = lLable(i)
           lLable(i) = New Label
           lLable(i).Name = "lLableX" & i
           lLable(i).Location = New Point(pProgress(i).Width + Location_control.X + 10, Location_control.Y)
           lLable(i).Width = Me.Width - 30
           lLable(i).Height = 20
           lLable(i).Text = 25
           Location_control.Y += 24
           Controls.Add(lLable(i))

           '  TA(i).Start(C)
       Next


   End Sub
قال صلى الله عليه وسلم: 
«كلمتان خفيفتان على اللسان 
ثقيلتان في الميزان،حبيبتان إلى الرحمن: 
سبحان الله وبحمده، سبحان الله العظيم».
الرد }}}
تم الشكر بواسطة: سعود , سعود , asmarsou , جيولوجي مبتدئ


الردود في هذا الموضوع
RE: فائدة على الهامش تمرير اكثر من بارامتر الى المسار thread - بواسطة Taha Okla - 02-09-22, 06:33 AM


التنقل السريع :


يقوم بقرائة الموضوع: