منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : احتاج كود الضغط على الكيبورد
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الصفحات : 1 2
(13-09-16, 05:57 PM)أبو عمر كتب : [ -> ]
Add ContextMenuStrip
add some items like file open save etc..
just copy this code
run your app
hid c key or right click on form
Good luck
PHP كود :
   Private Sub Form1_KeyPress(sender As ObjectAs System.Windows.Forms.KeyPressEventArgsHandles Me.KeyPress
        If e
.KeyChar "c" Then
            ContextMenuStrip1
.Show(Me.WidthMe.Height)
 
       End If
 
   End Sub
    Private Sub Form1_MouseDown
(sender As ObjectAs System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        If e
.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
 
       End If
 
   End Sub 

جاري التجريب  === Thank You

(13-09-16, 05:57 PM)أبو عمر كتب : [ -> ]
Add ContextMenuStrip
add some items like file open save etc..
just copy this code
run your app
hid c key or right click on form
Good luck
PHP كود :
   Private Sub Form1_KeyPress(sender As ObjectAs System.Windows.Forms.KeyPressEventArgsHandles Me.KeyPress
        If e
.KeyChar "c" Then
            ContextMenuStrip1
.Show(Me.WidthMe.Height)
 
       End If
 
   End Sub
    Private Sub Form1_MouseDown
(sender As ObjectAs System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        If e
.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
 
       End If
 
   End Sub 

اخي الكريم شكرا لك لي الرد والمساعد بس ياريت توضح الكود  لاني جديد واحتاج الا التعليم -- هل انشئ زر او لا؟ لم افهم = e.Button + e.KeyChar
PHP كود :
Private Sub Form1_MouseDown(sender As Objectميدو As System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        
If ميدو.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
        
End If
    
End Sub 

ولا تزعل ركز ف الكود كود عادي نسمية حدث زرار الماوس وهو مضغوط لاسفل سواء اليمين او اليسار
e حرف عادي ولا يسوى اي حاجة لكن عندما تجعله ككائن او متغير تصبح له قيمة كبيرة جدا
انا استبدلت e ب ميدو زي ما انت شايف
انما مطورون بيئة الدوت نت اخذو هذا الحرف وخلوه يتم انشاؤه بشكل تلقائي عند انشاء اي حدث لاي كائن
الكائن مثلا Form1
والحدث بتاعنا Mouse Down
والمتغيير اللي تدخل في الكود "e" أو ميدو اصبح ككائن ثاني مستقل يحمل خصائص
كائن من كائنات النظام في حالة الماوس داون او الكي اب
e as System.Windows.Forms.MouseEventArg
e as System.Windows.Forms.Keyup
وتقدر تستغني عن e.button ب Mouse.Button
مثلاً
if e.Button= Windows.Forms.MouseButtons.Right then
msgbox""
end if
أو
if mouse Button= Windows.Forms.MouseButtons.Right then
msgbox""
end if
وتقدر تختصر Windows.Forms.MouseButtons.Right مثلا
if MouseButton=MouseButton.Right then
msgbox("")
end if

PHP كود :
Public Class Form1



    
Private Sub Form1_KeyPress(sender As Objectميدو As System.Windows.Forms.KeyPressEventArgsHandles Me.KeyPress
        
If ميدو.KeyChar "c" Then
            ContextMenuStrip1
.Show(Me.WidthMe.Height)
        
End If

    
End Sub
    
Private Sub Form1_MouseDown(sender As Objectميدو As System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        
If ميدو.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
        
End If
    
End Sub

    
End 
Class 
بالتوفيق
(13-09-16, 07:35 PM)أبو عمر كتب : [ -> ]
PHP كود :
   Private Sub Form1_MouseDown(sender As Objectميدو As System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        If ميدو
.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
 
       End If
 
   End Sub 

ولا تزعل ركز ف الكود كود عادي نسمية حدث  زرار الماوس وهو مضغوط لاسفل سواء اليمين او اليسار
e حرف عادي ولا يسوى اي حاجة لكن عندما تجعله ككائن او متغير تصبح له قيمة كبيرة جدا
انا استبدلت e ب ميدو زي ما انت شايف
انما مطورون بيئة الدوت نت اخذو هذا الحرف وخلوه يتم انشاؤه بشكل تلقائي عند انشاء اي حدث لاي كائن
الكائن مثلا  Form1
والحدث بتاعنا Mouse Down
والمتغيير اللي تدخل في الكود "e" أو ميدو اصبح ككائن ثاني مستقل يحمل خصائص
كائن من كائنات النظام في حالة الماوس داون او الكي اب
e as System.Windows.Forms.MouseEventArg
e as System.Windows.Forms.Keyup
وتقدر تستغني عن e.button ب Mouse.Button
مثلاً
if e.Button= Windows.Forms.MouseButtons.Right then
msgbox""
end if
أو
if mouse Button= Windows.Forms.MouseButtons.Right then
msgbox""
end if
وتقدر تختصر  Windows.Forms.MouseButtons.Right  مثلا
if MouseButton=MouseButton.Right then
msgbox("")
end if

PHP كود :
Public Class Form1



    Private Sub Form1_KeyPress
(sender As Objectميدو As System.Windows.Forms.KeyPressEventArgsHandles Me.KeyPress
        If ميدو
.KeyChar "c" Then
            ContextMenuStrip1
.Show(Me.WidthMe.Height)
 
       End If

 
   End Sub
    Private Sub Form1_MouseDown
(sender As Objectميدو As System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        If ميدو
.Button Windows.Forms.MouseButtons.Right Then
            ContextMenuStrip1
.Show(Cursor.Position)
 
       End If
 
   End Sub

    
End 
Class 
بالتوفيق
 اسف اخوي بس والله مافهمت وش اسوي للاسف
الصفحات : 1 2