تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[مقال] فورم تسجيل دخول يتفاعل مع المستخدم
#7
ما شاء الله فكرة رائعة جدا 

لكن لماذا تايمر منفصل لكل حدث

عموما بعد اذنك قمت بالتعديل على الكود 
حيث تم الغاء كل التايمرز و الاكتفاء بواحد فقط و حذف الموديول 
و اعادة ترقيم الصور فى المجلد ( show password ) لتبدأ الارقام من 25 الى 30 بدلا من 1 الى 6

و هذا هو كود النموذج بعد التعديل

كود :
Public Class Form1
   Private WithEvents TT As New Timer
   Private CurrentBox As Integer = 0        '1 user select      2 user typing     3 password hidden      4 password shown   5 password leave

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Chk_showpass.Checked = False
       TxtPass.PasswordChar = "*"
   End Sub
   Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
       Application.Exit()
   End Sub
   Public Shared Function get_num(ByVal path As String) As Integer
       Dim num As Integer
       num = Val(IO.Path.GetFileNameWithoutExtension(path))
       Return num
   End Function
   Public Function TextPercent(ByVal Box As TextBox) As Integer 'داله لحساب النسبة المئوية لامتلاء textbox1
       Dim g As Graphics = Me.CreateGraphics
       Dim s As SizeF = g.MeasureString(Box.Text.ToString, New Font("Times New Roman", 16, FontStyle.Bold And FontStyle.Italic))
       Dim result As Integer = Math.Round((s.Width / Box.Width) * 100)
       Return result
   End Function

   Private Sub TxtUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtUser.Click
       CurrentBox = 1
       PictureBox1.ImageLocation = Application.StartupPath & "\images\email select\1.png"
       TT.Enabled = True
   End Sub
   Private Sub TxtUser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtUser.TextChanged
       If TxtUser.Text = "" Then PictureBox1.ImageLocation = Application.StartupPath & "\images\email typing\1.png"
       CurrentBox = 2
       TT.Enabled = True
   End Sub
   Private Sub TxtPass_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtPass.Enter
       If CurrentBox < 3 Then
           PictureBox1.ImageLocation = Application.StartupPath & "\images\password select\1.png"
           CurrentBox = 3
           If Chk_showpass.Checked Then CurrentBox = 4
       End If
       TT.Enabled = True
   End Sub
   Private Sub TxtPass_Leave(sender As Object, e As EventArgs) Handles TxtPass.Leave
       CurrentBox = 5
       PictureBox1.ImageLocation = Application.StartupPath & "\images\password deselect\1.png"
       TT.Enabled = True
   End Sub
   Private Sub Chk_showpass_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chk_showpass.CheckedChanged
       If CurrentBox < 3 Then
           PictureBox1.ImageLocation = Application.StartupPath & "\images\password select\1.png"
       ElseIf CurrentBox = 5 Then
           PictureBox1.ImageLocation = Application.StartupPath & "\images\password select\21.png"
           If Chk_showpass.Checked = False Then PictureBox1.ImageLocation = Application.StartupPath & "\images\show password\25.png"
       End If

       If Chk_showpass.Checked = False Then
           CurrentBox = 3
           TxtPass.PasswordChar = "*"
       Else
           CurrentBox = 4
           TxtPass.PasswordChar = ""
       End If
       TxtPass.Focus()
   End Sub

   Private Sub TT_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TT.Tick
       Select Case CurrentBox
           Case 1
               Dim file As String = Application.StartupPath & "\images\email select\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
               If IO.File.Exists(file) = True Then
                   PictureBox1.ImageLocation = file
               Else
                   TT.Enabled = False
               End If

           Case 2
               If TxtUser.Text <> "" Then
                   If TextPercent(TxtUser) > get_num(PictureBox1.ImageLocation) AndAlso TxtUser.Focused = True Then
                       If TextPercent(TxtUser) <= TxtUser.Width AndAlso TextPercent(TxtUser) <= 100 Then
                           Dim file As String = Application.StartupPath & "\images\email typing\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
                           PictureBox1.ImageLocation = file
                       End If
                   ElseIf TextPercent(TxtUser) < get_num(PictureBox1.ImageLocation) AndAlso TxtUser.Focused = True Then
                       If TextPercent(TxtUser) <= TxtUser.Width AndAlso TextPercent(TxtUser) <= 100 Then
                           Dim file As String = Application.StartupPath & "\images\email typing\" & get_num(PictureBox1.ImageLocation) - 1 & ".png"
                           PictureBox1.ImageLocation = file
                       End If
                   End If
               End If

           Case 3
               Dim file As String = Application.StartupPath & "\images\password select\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
               If IO.File.Exists(file) = True Then
                   PictureBox1.ImageLocation = file
               Else
                   TT.Enabled = False
               End If

           Case 4
               Dim file As String = ""
               If get_num(PictureBox1.ImageLocation) < 24 Then
                   file = Application.StartupPath & "\images\password select\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
               Else
                   file = Application.StartupPath & "\images\show password\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
               End If
               If IO.File.Exists(file) = True Then
                   PictureBox1.ImageLocation = file
               Else
                   TT.Enabled = False
               End If

           Case 5
               Dim file As String = Application.StartupPath & "\images\password deselect\" & get_num(PictureBox1.ImageLocation) + 1 & ".png"
               If IO.File.Exists(file) = True Then
                   PictureBox1.ImageLocation = file
               Else
                   TT.Enabled = False
               End If

           Case Else
               Dim file As String = Application.StartupPath & "\images\email select\1.png"
               If IO.File.Exists(file) = True Then PictureBox1.ImageLocation = file
               TT.Stop()
       End Select

   End Sub

End Class
الرد }}}
تم الشكر بواسطة: elgokr , mohamed haroon


الردود في هذا الموضوع
RE: فورم تسجيل دخول يتفاعل مع المستخدم - بواسطة mrnooo2000 - 19-06-18, 04:50 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  كيفيه عمل حفظ البيانات الخاصة بمتابعة دخول وخروج المستخدمين للبرنامج Saly nor 6 3,248 07-02-24, 05:56 PM
آخر رد: ahmedanwer
  [مشروع] حساب الوقت (دخول و خروج الموظف) Kamil 0 801 05-01-24, 08:04 PM
آخر رد: Kamil
Wink [مشروع] مشروع تصميم فورم بشكل جديد بالفيجوال ستوديو مع السورس كود ahmadpal 8 8,055 12-04-23, 11:41 PM
آخر رد: spiky
Heart شاشة تسجيل الدخول والصلاحيات alshandodi 1 3,263 13-01-23, 12:18 AM
آخر رد: alnagi
  تلقي رسائل من المستخدم بدون بريد aldery 0 1,275 25-07-21, 03:53 AM
آخر رد: aldery
  كيفية جعل المستخدم يستعرض اي ملف قاعدة بيانات اكسيس على جهازه مع امكانية كتابة الكود ggtt17121985 0 1,894 09-11-20, 12:03 AM
آخر رد: ggtt17121985
Big Grin [مشروع] سورس كود مع الشرح بالفيديو لانشاء فورم تسجيل الدخول ahmadpal 2 5,907 17-10-20, 02:29 PM
آخر رد: البلبل2010
  [مثال] تسجيل الدخول وصلاحيات المستخدمين essawq 2 3,677 13-07-20, 02:47 AM
آخر رد: essawq
Video تصميم فورم لتسجيل الدخول بشكل جميل ahmadpal 1 2,884 11-06-20, 08:22 AM
آخر رد: Mina Botros
  فورم دائري و زر بيضاوي [باستخدام فوتوشوب و TrancParenc color] سعود 0 1,579 31-05-20, 06:16 PM
آخر رد: سعود

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


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