مشاهدة النسخة كاملة : مساعدة في لعبتي ... لغة الفيجوال بيسك
داليا الجماز
11-05-2007, 08:24 AM
السلام عليكم و رحمة الله و بركاته ..
سويت لعبة عبارة عن تركيبة .. تسحب الصورة و تضعها في مكانها الصحيح .. أنا سويت البرنامج كاملا .. لكن للأسف الدكتورة قالت لازم تختصرونه .. و أنا ما عندي وقت خاصة انكم تعرفون أنه آخر الترم و إلى الان ننمتحن الميد تيرمز ..
حطيت بعض الميثودات اللي تحتاج تقصير في النوت باد .. لأنه الدكتورة ما اعجبها فتبغى طريقة ثانية . عشان كذا
و بخصوص عداد الوقت هل في طريقة بحيث اخليه على حسب صعوبة اللعبة .. يعني 3 دقائق للايزي و 5 للميديم و 8 للهارد .. و جزاكم الله خير ..
http://www.mediafire.com/?9htquuzhzzk
أتمنى أنكم تساعدوني بأقرب وقت قبل يوم الأحد .. و ما راح أنسى لكم المساعدة أبدا .. :biggthump
بحث لك في النت وهذا الي حصلتة
هذا شخص وجد كودك جدا رائع و كتب طريقه لإختصاره
Re: a game project for in VB.Net
Actually your code looks very neat, well done.
First criticism, you do not have;
Option Strict On
The obvious areas is the one mentioned where you have long expressions excluding various components;
If Not target.Equals(Pic1) AndAlso Not target.Equals(Pic2) AndAlso Not target.Equals(Pic3) AndAlso Not target.Equals(Pic4) AndAlso Not target.Equals(Pic5) AndAlso Not target.Equals(Pic6) AndAlso Not target.Equals(Pic7) AndAlso Not target.Equals(Pic8) AndAlso Not target.Equals(Pic9) AndAlso Not target.Equals(Pic10) AndAlso Not target.Equals(Pic11) AndAlso Not target.Equals(Pic12) AndAlso Not target.Equals(Pic13) AndAlso Not target.Equals(Pic14) AndAlso Not target.Equals(Pic15) AndAlso Not target.Equals(Pic16) AndAlso Not target.Equals(Pic17) AndAlso Not target.Equals(Pic18) AndAlso Not target.Equals(Pic19) AndAlso Not target.Equals(Pic20) Then
Since you have Pic1 to Pic20 and you want to exclude all of them you could do something like;
If target.Name.Length <= 3 OR _
(target.Name.Length > 3 AndAlso target.Name.Substring(0,3) <> "Pic") Then
I also notice you do this
If target.Name = "Pic1" OR ..... Then
s = True
Else
s = False
End If
If s Then
pic.Visible = False
End If
where you could just do this;
s = target.Name = "Pic1" OR .....
pic.Visible = NOT s
Call me anal but I always like to see variables initialized;
Dim j As Integer = 0
Dim k As String = String.Empty
and to be even more anal, I also like to see variable names that are meaningful, even though it's more typing;
Dim NumberOfPictures As Integer = 0
You can also tidy some code by doing;
'In situations like this
Pic10.Visible = True
Pic10.AllowDrop = True
Pic10.Enabled = True
'Doing this instead
With Pic10
.Visible = True
.AllowDrop = True
.Enabled = True
End With
You can get rid of the event code by creating the PictureBoxes programatically, so for example;
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim Pic(10) As PictureBox
For i As Integer = 0 To Pic.GetUpperBound(0)
Pic(i) = New PictureBox
'Add the box to the form
Me.Controls.Add(Pic(i))
'Position each box to the right of the previous
If i > 0 Then Pic(i).Left = Pic(i - 1).Right + 10
With Pic(i)
'Set the borderstyle
.BorderStyle = BorderStyle.FixedSingle
'Give the instance a name
.Name = "Pic" & i.ToString
'Add a handler to invoke on the relevant event
End With
AddHandler Pic(i).Click, AddressOf PictureBoxHandler
Next
End Sub
Private Sub PictureBoxHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Will handle all Pic boxes
MessageBox.Show(CType(sender, PictureBox).Name.ToString)
End Sub
Hope these comments help, as I mentioned at the beginning, your code is pretty good.
_____________________________
http://www.vbforums.com/showthread.php?t=468342
جميع حقوق برمجة vBulletin محفوظة ©2025 ,لدى مؤسسة Jelsoft المحدودة.
جميع المواضيع و المشاركات المطروحة من الاعضاء لا تعبر بالضرورة عن رأي أصحاب شبكة المنتدى .