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



نتائج مسابقة المقالات الربع الثاني 2010 - الإنتهاء: 27-09-10

أهلا بالضيف - الإنتهاء: 07-09-10

كاميليا - الإنتهاء: 31-10-10

عـودة للخلف   منتدى فيجوال بيسك > قسم أسئلة واستفسارات الأعضاء > تقنية dot NET العام > برمجة الأجهزة المحمولة Mobile

برمجة الأجهزة المحمولة Mobile الأسئلة والنقاش حول برمجة الأجهزة المحمولة Mobile باستحدام تقنية دوت نت وأدوات مايكروسوفت

موضوع مغلق
 
أدوات الموضوع طريقة العرض
قديم 02-09-07   #1
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي تم الانتهاء من السلسلة : سلسلة تنفيذ المهام المختلفة على ال Pocket PC من خلال VB.net

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .

هذه سلسلة بسيطة بها مجموعة من الأكواد والمهام التي يتطلبها العمل على Pocket PC في مجالات متعددة تضم النقل وقواعد البيانات والشاشات والأجهزة وخلافه . سيتم طرحها على شكل سلسلة من 6 دروس خلال نفس الموضوع أتمنى أن تكون مفيدة بإذن الله تعالى .

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .
__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
العضو التالي يشكر أحمد جمال على هذه المشاركة :
قديم 02-09-07   #2
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application ، ولمعرفة كيفية البدء بأول تطبيق بسيط يمكنك مراجعة الرابط التالي :
http://vb4arab.com/vb/showthread.php?t=18

في هذا الدرس سوف نتعلم كيفية التعامل مع ال Forms وما يتعلق بها .
سنبدأ بكيفة توسيط الفورم الخاص بك داخل الشاشة الخاصة بال Pocket PC ، نقوم بهذا بواسطة الأمر التالي :

رمز:
 
    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    Me.Size = New Size(200, 200)
    Me.BackColor = Color.Red
    'Get the size of the screen for centering the form.
    Dim rectS As Rectangle = Screen.PrimaryScreen.Bounds
    Me.Location = New Point(CInt((rectS.Width - Me.Width) / 2), CInt((rectS.Height - Me.Height ) / 2))

ماذا عن وضع صورة كخلفية للفورم ، هذا هو الكود الخاص بذلك :

رمز:
 
    Dim asm As System.Reflection.Assembly
    asm = System.Reflection.Assembly.GetExecutingAssembly()
    ' Note that the name for the embedded resource
    ' is case sensitive and must match the file name.
    Dim backGroundImage As New Bitmap(asm.GetManifestResourceStream("PocketPCApplication1.mypicture.bmp"))
    e.Graphics.DrawImage(backgroundImage, Me.ClientRectangle, _
        New Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height), _
        GraphicsUnit.Pixel)

لجعل الفورم full screen :

رمز:
 
Me.WindowState = FormWindowState.Maximized
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.ControlBox = False
Me.Menu = Nothing
Me.ControlBox = False
ولتحديد اتجاه الشاشة في الأجهزة التي يمكن تحديد اتجاه الشاشة فيها ( أفقي - عمودي ) :

رمز:
 
SystemSettings.ScreenOrientation = ScreenOrientation.Angle90
والآن لنجرب تعديل بعض الخصائص ، لاخفاء زر X مثلاً :
رمز:
 
Me.ControlBox = False
ولاخفاء ال menu bar كاملة :
Me.Menu = Nothing
ولجعل الفورم resizable :
رمز:
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
أما لتغيير الحجم من خلال الكود فيمكن عملها بهذه الطريقة على سبيل المثال :
رمز:
Me.Size = New Size(200, 200)
أشرطة التمرير ، لعمل أشرطة تمرير قم برسمها مباشرة على الفورم ، أما الكود الخاص بشريط التمرير الأفقي أو العمودي فهو بالشكل التالي :

رمز:
 
Private Sub HScrollBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles HScrollBar1.ValueChanged
    Me.Panel1.Left = -Me.HScrollBar1.Value
End Sub
Private Sub VScrollBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles VScrollBar1.ValueChanged
    Me.Panel1.Top = -Me.VScrollBar1.Value
End Sub

ماذا عن العمل في وجود SIP وال SIP هي لوحة المفاتيح التي تكون موجودة على الشاشة ويمكن النقر عليها مباشرة Toutch Screen ، في هذه الحالة تكون محتاجاً إلى عرض بعض اشرطة التمرير Scroll bar حسب التحديد ، لذا هذا الكود يقوم بهذه المهمة ، والخطوات مشروحة في منتصف الكود .

رمز:
' Shortens the height of a ListBox when the SIP
' (Soft Input Panel) is displayed so that the vertical
' scroll bar of the ListBox is not obscured by the SIP.
' Size the ListBox to about the height of the form.
' Put the TextBox to the upper right or left of the list box.
' When the TextBox receives focus, the SIP is enabled.
' When the ListBox receives focus, the SIP is disabled.
Dim ListBoxFullHeight As Integer
' Call this method from the constructor,
' or Form_Load event, of your form.
Private Sub SetListBoxFullHeight
    ' Determine the original height of the list box.
    ListBoxFullHeight = ListBox1.Height
End Sub
' The InputPanel.EnabledChanged event
' occurs whenever the SIP is enabled or disabled.
Private Sub InputPanel1_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles InputPanel1.EnabledChanged
    Dim VisibleRect As System.Drawing.Rectangle
    If InputPanel1.Enabled = False Then
        ' The SIP is disabled, so the height of the ListBox
        ' is set to its original full height (ListBoxFullHeight).
        ListBox1.Height = ListBoxFullHeight
    Else
        ' The SIP is enabled, so the height of the ListBox
        ' is set to the height of the visible desktop area,
        ' minus 10 pixels for padding.
        VisibleRect = InputPanel1.VisibleDesktop
        ListBox1.Height = VisibleRect.Height - 20
    End If
End Sub
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
    ' Display the SIP for entering text.
    InputPanel1.Enabled = True
End Sub
Private Sub ListBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.GotFocus
    ' Hide the SIP.
    InputPanel1.Enabled = False
End Sub


ختاماً أذكر بإن الأكواد منقولة من موقع مختص بأكواد ال Pocket PC ، في الدرس القادم سوف نواصل مع أوامر أخرى متعلقة بال Pocket PC .

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .
__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 02-09-07   #3
mhsnt
عضو جديد
 
تاريخ التسجيل: Aug 2007
المشاركات: 8
عدد مرات شكره للأعضاء: 0
تم شكره 0 مره في 0 مشاركه
قوة التقييم: 0
mhsnt is on a distinguished road
الافتراضي

مشكوووووووور على المجهود الطيب
mhsnt غير متصل  
قديم 03-09-07   #4
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .

نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application .

في هذا الدرس سوف نتعلم كيفية التعامل مع الأدوات وما يتعلق بها ، وسنبدأ بكيفية عرض زر الخاص بالكيبورد SIP والذي يقوم بعرض الكيبورد على الشاشة تلقائياً :

رمز:
    InputPanel1.Enabled = True


ماذا لو أردنا عمل Document List لنعرض فيها الملفات الموجودة في المستندات :

رمز:
      DocumentList1.Parent = Me
      DocumentList1.Filter = " |*.*| |*.txt;*.xml| |*.pwi;*.pdt| |*.pxl;*.psw| |*.jpg;*.gif;*.bmp| |*.wav;*.wmv;*.mpg;"
      DocumentList1.FilterIndex = 0
      DocumentList1.SelectedDirectory = "Business"


وسيتيح لنا الحدث التالي الطرق المناسبة للتعامل مع هذه القائمة سواء اختيار عنصر أو تحديد عنصر :

رمز:
    Private Sub DocList_SelectedDirectoryChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DocumentList1.SelectedDirectoryChanged
        ' Add code to access the selected folder to open and close files.
    End Sub


والآن لنفترض أننا قمنا بعمل Link Label ونود قراءة حدث الضغط عليه ، يتم هذا بواسطة الحدث التالي :

رمز:
    Private Sub LinkLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkLabel1.Click
        MsgBox("Mouse click")
    End Sub


أما من أجل ضغط الماوس keyDown أو القلم فنستخدم الحدث التالي :

رمز:
    Private Overloads Sub OnKeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        MsgBox("Key Down")
    End Sub


نعود مرة أخرى مع أمر شائع الاستخدام وهو ارسال رسالة تحذيرية إلى المستخدم Notfication ، يتم هذا بواسطة الأمر التالي على سبيل المثال :

رمز:
Private Sub sendNotfication(ByVal message As String)
        ' Set the Text property to the HTML string.
        Notification1.Text = message
        ' Get the icon as an embedded resource.
        ' Note that icon must be added to project as an embedded resource.
        Dim asm As System.Reflection.Assembly
        asm = System.Reflection.Assembly.GetExecutingAssembly()
        ' Note that the name for the embedded resource
        ' is case sensitive and must match the file name.
        Dim s As Stream = asm.GetManifestResourceStream("PocketPCApplication1.notify.ico")
        Notification1.Icon = New Icon(s, 16, 16)
        ' If the notification is canceled, its icon remains
        ' available for later activating the notification.
        Notification1.Caption = "Notification"
        Notification1.Critical = False
        ' Initially display the notification for 10 seconds.
        Notification1.InitialDuration = 10
        Notification1.Visible = True
    End Sub


أمر آخر شائع الاستخدام وهو كيفية تغيير اسلوب ادخال البيانات ، مثل ادخالها عن طريق الكيبورد SIP أو ادخالها عن طريق Letter Recognizer حيث يقوم بكتابة الحروف بالرسم على الشاشة ، نستخدم الأمر التالي مثلاً :

رمز:
    ' Sets the input method to Letter Recognizer.
    For Each method As InputMethod In InputPanel1.InputMethods
        If method.Name = "Letter Recognizer" Then
            InputPanel1.CurrentInputMethod = method
            Exit For
        End If
    Next


آخر اوامرنا في هذا الدرس هو كيفية انشاء زر أمر بصورة ، سنتعلم هنا كيف نقوم بعمل هذه الأداة والشرح موجود ضمن الخطوات :
رمز:
Public Class PictureButtonDemo
   Inherits System.Windows.Forms.Form
    Friend WithEvents PictureButton1 As New PictureButton
    Public Sub New()
        ' Display the OK close button.
        Me.MinimizeBox = False
        Me.Text = "Picture Button Demo"
        ' Create an instance of the PictureButton custom control.
        With PictureButton1
            .Parent = Me
            .Bounds = New Rectangle(10, 30, 150, 30)
            .ForeColor = Color.White
            .BackgroundImageValue = MakeBitmap(Color.Blue, PictureButton1.Width, PictureButton1.Height)
            .PressedImageValue = MakeBitmap(Color.LightBlue, PictureButton1.Width, PictureButton1.Height)
            .Text = "Click Me"
        End With
    End Sub
    ' Clean up any resources being used.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        MyBase.Dispose(disposing)
    End Sub
    ' Create a bitmap object, fill it with the specified color.
    ' To make it look like a custom image, draw an ellipse in it.
    Function MakeBitmap(ByVal ButtonColor As Color, ByVal width As Integer, ByVal height As Integer) As Bitmap
        Dim bmp As New Bitmap(width, height)
        Dim g As Graphics = Graphics.FromImage(bmp)
        g.FillRectangle(New SolidBrush(ButtonColor), 0, 0, bmp.Width, bmp.Height)
        g.DrawEllipse(New Pen(Color.LightGray), 3, 3, width - 6, height - 6)
        g.Dispose()
        Return bmp
    End Function
    Shared Sub Main()
        Application.Run(New PictureButtonDemo)
    End Sub
    ' Because PictureButton inherits from Control,
    ' you can use the default Click event.
    Private Sub PictureButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PictureButton1.Click
        'Add code here to respond to button click.
    End Sub
End Class
'Button with an image custom control.
Public Class PictureButton
    Inherits Control
    Private backgroundImg As Image
    Private pressedImg As Image
    Private pressed As Boolean = False
    ' Property for the background image to be drawn behind the button text.
    Public Property BackgroundImageValue() As Image
        Get
            Return Me.backgroundImg
        End Get
        Set(ByVal Value As Image)
            Me.backgroundImg = Value
        End Set
    End Property
    ' Property for the background image to be drawn behind the button text when
    ' the button is pressed.
    Public Property PressedImageValue() As Image
        Get
            Return Me.pressedImg
        End Get
        Set(ByVal Value As Image)
            Me.pressedImg = Value
        End Set
    End Property
    ' Ivalidate form to cause repaint.
    Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
        Me.pressed = True
        Me.Invalidate()
        MyBase.OnMouseDown(e)
    End Sub
    ' When the mouse is released, reset the "pressed" flag
    ' and invalidate to redraw the button in the un-pressed state.
    Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
        Me.pressed = False
        Me.Invalidate()
        MyBase.OnMouseUp(e)
    End Sub
    ' Override the OnPaint method so we can draw the background image and the text.
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            If Me.pressed AndAlso (Me.pressedImg IsNot Nothing) Then
                    e.Graphics.DrawImage(Me.pressedImg, 0, 0)
                Else
                    e.Graphics.DrawImage(Me.backgroundImg, 0, 0)
        End If
        ' Draw the text if there is any.
        If Me.Text.Length > 0 Then
            Dim size As SizeF = e.Graphics.MeasureString(Me.Text, Me.Font)
            ' Center the text inside the client area of the PictureButton.
            e.Graphics.DrawString(Me.Text, Me.Font, New SolidBrush(Me.ForeColor), (Me.ClientSize.Width - size.Width) / 2, (Me.ClientSize.Height - size.Height) / 2)
        End If
        ' Draw a border around the outside of the
        ' control to  look like Pocket PC buttons.
        e.Graphics.DrawRectangle(New Pen(Color.Black), 0, 0, Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)
        MyBase.OnPaint(e)
    End Sub
End Class



في انتظار الدرس القادم والذي سيكون خاصاً بالتعامل مع الصور والرسوميات .

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .
__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 04-09-07   #5
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application .

في هذا الدرس سوف نتعلم كيفية التعامل مع الصور والرسوميات ، وسنبدأ بأوامر التعامل الأساسية مع Bitmap انشاء وحذف ، نسخ ، وتحريك :

رمز:
 
Dim bmpSource As Bitmap
Dim bmpClone As Bitmap
Dim bmpCenter As Bitmap
' Creates a bitmap for copying and cloning.
Function CreateBitmap(sideSize As Integer) As Bitmap
    Dim bmp As New Bitmap(sideSize, sideSize)
    Dim g As Graphics = Graphics.FromImage(bmp)
    g.FillEllipse(New SolidBrush(Color.Red), 0, 0, sideSize, sideSize)
    g.DrawLine(New Pen(Color.Black), 0, 0, sideSize, sideSize)
    g.DrawLine(New Pen(Color.Black), sideSize, 0, 0, sideSize)
    g.Dispose()
    Return bmp
End Function
' Copies the entire bitmap.
Overloads Function CopyBitmap(bmpSource As Bitmap) As Bitmap
    Return New Bitmap(bmpSource)
End Function
' Copies a part of the bitmap.
Overloads Function CopyBitmap(bmpSource As Bitmap, part As Rectangle) As Bitmap
    Dim bmp As New Bitmap(part.Width, part.Height)
    Dim g As Graphics = Graphics.FromImage(bmpSource)
    g.DrawImage(bmpSource, 0, 0, part, GraphicsUnit.Pixel)
    g.Dispose()
    Return bmp
End Function
' Calls the above methods.
Private Sub CreateAndCopy()
    Dim w As Integer = 75
    Dim third As Integer = CInt(w / 3)
    ' Create bitmap.
    bmpSource = CreateBitmap(w)
    ' Copy entirely as a clone.
    bmpClone = CopyBitmap(bmpSource)
    ' Copy the center part of it.
    bmpCenter = CopyBitmap(bmpSource, New Rectangle(third, third, third, third))
End Sub
' Draws the bitmaps on the form.
Protected Overrides Sub OnPaint(e As PaintEventArgs)
    Dim arialFont As Font
    Dim blackBrush As Brush
    arialFont = New Font("Arial", 10, FontStyle.Regular)
    blackBrush = New SolidBrush(Color.Black)
    Dim y As Integer = 10
    e.Graphics.DrawString("source bitmap", ArialFont, BlackBrush, 10, y)
    y += 20
    e.Graphics.DrawImage(bmpSource, 10, y)
    y += bmpSource.Height + 10
    e.Graphics.DrawString("clone bitmap", ArialFont, BlackBrush, 10, y)
    y += 20
    e.Graphics.DrawImage(bmpClone, 10, y)
    y += bmpClone.Height + 10
    e.Graphics.DrawString("center part of bitmap", ArialFont, BlackBrush, 10, y)
    y += 20
    e.Graphics.DrawImage(bmpCenter, 10, y)
    y += bmpCenter.Height + 10
    ' Dispose graphic objects.
    arialFont.Dispose()
    blackBrush.Dispose()
End Sub

لعمل صورة شفافة :

رمز:
 
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    Dim attr As New ImageAttributes
    ' Sets the transparency color key based on the upper left pixel of the image.
    attr.SetColorKey(bmp.GetPixel(0, 0), bmp.GetPixel(0, 0))
    ' Alternatively, you can also explicitly set the transparacy color.
    attr.SetColorKey(Color.FromArgb(255, 0, 255), Color.FromArgb(255, 0, 255))
    attr.SetColorKey(Color.Fuchsia, Color.Fuchsia)
    ' Draw the image using the image attributes.
    Dim rect As New Rectangle(0, 0, bmp.Width, bmp.Height)
    e.Graphics.DrawImage(bmp, rect, 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attr)
End Sub


لرسم صندوق مثلاً يحتوي على نص بداخله :


رمز:
 
Protected Overrides Sub OnPaint(e As PaintEventArgs)
    Dim s As String = "Hello World!"
    Dim pen As New Pen(Color.Red, 5)
    Dim font As New Font("Arial", 18, FontStyle.Regular)
    Dim brush As New SolidBrush(Color.Black)
    Dim textSize As SizeF = e.Graphics.MeasureString(s, font)
    ' Create a rectangle with padding space between string and box.
    Dim r As New Rectangle(45, 70, CInt(Fix(textSize.Width) + 10), CInt(Fix(textSize.Height) + 10))
    e.Graphics.DrawRectangle(pen, r)
    e.Graphics.DrawString(s, font, brush, 50F, 75F)
    MyBase.OnPaint(e)
End Sub



لعمل Save لأي صورة :

رمز:
 
    PictureBox1.Image.Save(".\My Documents\savedbmp.bmp", ImageFormat.Bmp)

ولعمل Zoom على صورة :

رمز:
 
Dim bmp as Bitmap
Dim bmpZoom as Bitmap
' First call CreateBitmap, then call DefineZoom.
Sub CreateBitmap()
    bmp = New Bitmap(75,75)
    Dim g As Graphics = Graphics.FromImage(bmp)
    Dim BlueBrush As New SolidBrush(Color.Blue)
    Dim RedBrush As New SolidBrush(Color.Red)
    Dim OuterRect As New Rectangle(0, 0, 200, 200)
    g.FillRectangle(BlueBrush, OuterRect)
    Dim InnerRect As New Rectangle(25, 25, 25, 25)
    g.FillRectangle(RedBrush, InnerRect)
    g.Dispose()
End Sub
Sub DefineZoom()
    ' Call this method after CreateBitmap
    ' from the constructor of your form.
    bmpZoom = New Bitmap(bmp.Width, bmp.Height)
    Dim g As Graphics = Graphics.FromImage(bmpZoom)
    Dim srcRect As New Rectangle(CInt(bmp.Width / 4), CInt(bmp.Height / 4), _
        CInt(bmp.Width / 2), CInt(bmp.Height / 2))
    Dim dstRect As New Rectangle(0, 0, bmpZoom.Width, bmpZoom.Height)
    g.DrawImage(bmp, dstRect, srcRect, GraphicsUnit.Pixel)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    e.Graphics.DrawImage(bmp, 0, 0)
    e.Graphics.DrawImage(bmpZoom, 125, 0)
    bmp.Dispose
    bmpZoom.Dispose
    MyBase.OnPaint(e)
End Sub

وكما تعلمنا في درس سابق خاص بالتعامل مع الصور على هذا الرابط :
http://vb4arab.com/vb/showthread.php...E6%CC%E6%C7%C8
يمكننا انشاء Graphics Object بأكثر من طريقة ، فمثلا لانشاءه من Bitmap :

رمز:
 
Dim bmp As New Bitmap(10, 10)
Dim g As Graphics = Graphics.FromImage(bmp)

ولانشاءه من خلال حدث OnPaint :

رمز:
 
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    ' Use the Graphics object from the PaintEventArgs
    ' for tasks such as drawing a line.
    ' Create pen.
    Dim blackPen As New Pen(Color.Black, 3)
    ' Create coordinates of points that define line.
    Dim x1 As Integer = 100
    Dim y1 As Integer = 100
    Dim x2 As Integer = 500
    Dim y2 As Integer = 100
    ' Draw line to screen.
    e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)
End Sub



يمكن انشاءه من خلال أي أداة أيضاً :

رمز:
 
Dim g As Graphics = Me.CreateGraphics()

آخر أوامرنا في هذاالدرس هو كيفية رسم كلمات بزوايا عرض مختلفة ، هذا التطبيق مشروح ضمن الخطوات :

رمز:
 
Sub SetupLogFont()
    ' Create and define a LogFont structure.
    fontStruct = New Microsoft.WindowsCE.Forms.LogFont()
    With fontStruct
        .Height = -24
        .Width = 0
        .Weight = 0
        ' Set the font angled at 90 degrees.
        ' Remember to multiply by 10.
        .Escapement = 900
        ' The Escapement member specifies both the
        ' escapement and orientation. You should set
        ' Escapement and Orientation to the same value.
        .Orientation = fontStruct.Escapement
        ' No formmatting.
        .Italic = 0
        .Underline = 0
        .StrikeOut = 0
        .CharSet = LogFontCharSet.Default
        .OutPrecision = LogFontPrecision.Default
        .ClipPrecision = LogFontClipPrecision.Default
        .Quality = LogFontQuality.Default
        .PitchAndFamily = LogFontPitchAndFamily.Default
        .FaceName = "Arial"
    End With
    ' Create the font from the LogFont structure.
    Me.Font = System.Drawing.Font.FromLogFont(fontStruct)
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
    ' Create string to draw.
    Dim drawString As String = "Some Text"
    ' Create font and brush.
    Dim drawBrush As New SolidBrush(Color.Red)
    ' Create rectangle for drawing.
    Dim x As Integer = 25
    Dim y As Integer = 200
    Dim width As Integer = 150
    Dim height As Integer = -150
    Dim drawRect As New RectangleF(x, y, width, height)
    ' Draw rectangle to screen with White border to hide.
    Dim WhitePen As New Pen(Color.White)
    e.Graphics.DrawRectangle(WhitePen, x, y, width, height)
    ' Draw string to screen using the LogFont.
    e.Graphics.DrawString(drawString, Me.Font, drawBrush, drawRect)
End Sub


نواصل في الدرس القادم بمشيئة الله تعالى مع أوامر أخرى ...

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .

__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 04-09-07   #6
adelt123
عضو
 
تاريخ التسجيل: Aug 2007
المشاركات: 153
عدد مرات شكره للأعضاء: 0
تم شكره 5 مره في 5 مشاركه
قوة التقييم: 0
adelt123 is an unknown quantity at this point
الافتراضي

جزاك الله كل خير وجعلها في ميزان حسناتك
adelt123 غير متصل  
قديم 05-09-07   #7
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application يمكنك مراجعة الدروس السابقة لأوامر أخرى ، ولتحديد كيف تبدأ بعمل تطبيقك الأول راجع الرابط التالي :
http://vb4arab.com/vb/showthread.php?t=18

بداية في هذا الدرس سوف نتعلم كيفية قراءة وتعديل ساعة الجهاز ، يتم ذلك بالاعتماد على دوال API التالية :

رمز:
rivate Structure SYSTEMTIME
        Public wYear As UShort
        Public wMonth As UShort
        Public wDayOfWeek As UShort
        Public wDay As UShort
        Public wHour As UShort
        Public wMinute As UShort
        Public wSecond As UShort
        Public wMilliseconds As UShort
    End Structure
    Private Declare Function GetSystemTime Lib "CoreDll.dll" (ByRef lpSystemTime As SYSTEMTIME) As UInteger
    Private Declare Function SetSystemTime Lib "CoreDll.dll" (ByRef lpSystemTime As SYSTEMTIME) As UInteger


بعد ذلك يمكن استخدام هذه الدالة من أجل قراءة الوقت :

رمز:
    Public Shared Function GetDateTime() As Date
        Dim st As SYSTEMTIME
        GetSystemTime(st)
        'Return the current SYSTEMTIME as a Date
        Return New Date(st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds)
    End Function



ومن أجل الكتابة وتعديل الوقت :

رمز:
    Public Shared Sub SetDateTime(ByVal newDateTime As Date)
        Dim newTime As SYSTEMTIME
        'Convert the Date to SYSTEMTIME
        newTime.wYear = newDateTime.Year
        newTime.wMonth = newDateTime.Month
        newTime.wDay = newDateTime.Day
        newTime.wHour = newDateTime.Hour
        newTime.wMinute = newDateTime.Minute
        newTime.wSecond = newDateTime.Second
        newTime.wMilliseconds = newDateTime.Millisecond
        SetSystemTime(newTime)
    End Sub


لقراءة الذاكرة المتاحة في الجهاز الآن :

رمز:
Friend Structure MEMORYSTATUS
        Public dwLength As UInteger
        Public dwMemoryLoad As UInteger
        Public dwTotalPhys As UInteger
        Public dwAvailPhys As UInteger
        Public dwTotalPageFile As UInteger
        Public dwAvailPageFile As UInteger
        Public dwTotalVirtual As UInteger
        Public dwAvailVirtual As UInteger
    End Structure
    Friend Declare Function GlobalMemoryStatus Lib "CoreDll.Dll" (ByRef ms As MEMORYSTATUS) As Integer
    Friend Shared Function GetMemory() As MEMORYSTATUS
        Dim memStatus As New MEMORYSTATUS
        GlobalMemoryStatus(memStatus)
        Return memStatus
    End Function


بالنسبة للملتيميديا لتشغيل ملف صوتي :

رمز:
Private Declare Function WCE_PlaySound Lib "CoreDll.dll" Alias "PlaySound" _
        (ByVal szSound As String, ByVal hMod As IntPtr, ByVal flags As Integer) As Integer
    Public Shared Sub PlaySoundFile(ByVal soundFile As String)
        Const SND_ASYNC = &H1
        Const SND_FILENAME = &H20000
        WCE_PlaySound(soundFile, IntPtr.Zero, SND_ASYNC Or SND_FILENAME)
    End Sub


وأخيراً لعمل Reset للجهاز :

رمز:
Private Declare Function KernelIoControl Lib "coredll.dll" (ByVal dwIoControlCode As Integer, ByVal lpInBuf As IntPtr, ByVal nInBufSize As Integer, ByVal lpOutBuf As IntPtr, ByVal nOutBufSize As Integer, ByRef lpBytesReturned As Integer) As Integer
    Private Function CTL_CODE(ByVal DeviceType As Integer, ByVal Func As Integer, ByVal Method As Integer, ByVal Access As Integer) As Integer
        Return (DeviceType << 16) Or (Access << 14) Or (Func << 2) Or Method
    End Function
    Private Function ResetPocketPC() As Integer
        Const FILE_DEVICE_HAL As Integer = &H101
        Const METHOD_BUFFERED As Integer = 0
        Const FILE_ANY_ACCESS As Integer = 0
        Dim bytesReturned As Integer = 0
        Dim IOCTL_HAL_REBOOT As Integer
        IOCTL_HAL_REBOOT = CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
        Return KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
    End Function


نواصل في الدرس القادم بمشيئة الله تعالى مع أوامر أخرى ...

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .
__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 07-09-07   #8
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application ففي هذا الدرس سوف نتعلم كيفية التعامل مع قواعد البيانات ، وتحديداً مع ال DataGrid . وبداية سنتعلم كيفية تحديد ال DataSource الخاص بال DataGrid :

رمز:
 
Private Sub SetDataSource()
    Dim sqlConn As System.Data.SqlServerCe.SqlCeConnection
    Dim sqlDS As New DataSet
    ' It is assumed that there is a SQL Server Mobile Edition database
    ' named test.sdf, and that the database has a table named
    ' People. These should be modified to fit your application.
    sqlConn = New SqlCeConnection("Data Source = \My Documents\test.sdf")
    ' Select everything from a database named People on the SqlCeConnection sqlConn.
    Dim sqlDA As New SqlCeDataAdapter("SELECT * FROM People", sqlConn)
    ' Fill the DataTable People within the DataSet sqlDS.
    sqlDA.Fill(sqlDS, "People")
    ' Set the DataSource as the People table in the DataSet.
    dataGrid1.DataSource = sqlDS.Tables("People")
End Sub
والآن سنرى كيفية اضافة صفوف وأعمدة إلى قواعد البيانات - طبعاً بعد انشاء DataSet كمرحلة أولى - :

رمز:
 
  Private Sub SetUpDataGrid()
      Dim BindingSource1 As New BindingSource
     ' Create a DataSet with a
     ' table of customer sales data.
      Dim myDataSet As New DataSet("myDataSet")
      Dim tSales As New DataTable("Sales")
      ' Add three columns.
      Dim colDate As New DataColumn("Date", GetType(DateTime))
      Dim colCust As New DataColumn("Customer")
      Dim colTotal As New DataColumn("Total", GetType(Decimal))
      tSales.Columns.Add(colDate)
      tSales.Columns.Add(colCust)
      tSales.Columns.Add(colTotal)
      ' Add the table to the DataSet.
      myDataSet.Tables.Add(tSales)
      'Add needed rows.
      Dim newRow As DataRow
      Dim i As Integer
      For i = 1 To 3
         newRow = tSales.NewRow()
         tSales.Rows.Add(newRow)
      Next i
      ' Populate the table withe customer data.
      tSales.Rows(0)("Date") = DateTime.Today
      tSales.Rows(0)("Customer") = "Parker, Darren"
      tSales.Rows(0)("Total") = 123.23
      tSales.Rows(1)("Date") = DateTime.Today
      tSales.Rows(1)("Customer") = "Ji, Jeune"
      tSales.Rows(1)("Total") = 4322.33
      tSales.Rows(2)("Date") = DateTime.Today
      tSales.Rows(2)("Customer") = "Tibbott, Diane"
      tSales.Rows(2)("Total") = 1222.33
      ' Set the BindingSource to the DataSet.
      BindingSource1.DataSource = myDataSet
      ' Bind the DataGrid to the BindingSource.
      dataGrid1.DataSource = BindingSource1
      ' Set the current binding item to the Sales table.
      BindingSource1.DataMember = "Sales"
   End Sub
التعديل في ال DataGrid

رمز:
 
Private Sub dataGrid_CurrentCellChanged(ByVal sender As Object, ByVal e As EventArgs) _
    Handles DataGrid.CurrentCellChanged
    Dim currentCell As DataGridCell
    Dim currentCellData As String
    ' Get the current cell.
    currentCell = DataGrid.CurrentCell
    ' Get the current cell's data.
    currentCellData = CStr(DataGrid(currentCell.RowNumber, currentCell.ColumnNumber))
    ' interact with currentCellData
End Sub
Private Sub buttonSetCurrentCell_Click(ByVal o As Object, ByVal e As EventArgs) _
    Handles buttonSetCurrentCell.Click
    Dim currentCell As DataGridCell
    Dim currentCellData As String
    ' Get the text to put into the current cell.
    currentCellData = "New value"
    ' Get the current cell.
    currentCell = DataGrid.CurrentCell
    ' Set the current cell's data.
    DataGrid(currentCell.RowNumber, currentCell.ColumnNumber) = currentCellData
End Sub

وأخيراً عمل Sort لل DataGrid :

رمز:
 
        BindingSource1.Sort = "columnName" & " DESC"


نواصل في الدرس القادم بمشيئة الله تعالى مع أوامر أخرى ...

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .

__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 09-09-07   #9
أبوعبدالملك
مبرمج طموح
 
تاريخ التسجيل: Jun 2007
المشاركات: 119
عدد مرات شكره للأعضاء: 4
تم شكره 6 مره في 6 مشاركه
قوة التقييم: 4
أبوعبدالملك is on a distinguished road
الافتراضي

مشكور على المشاركة الجميلة

بارك الله فيك
أبوعبدالملك غير متصل  
قديم 14-09-07   #10
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application ، في هذا الدرس سوف نتعلم كيفية التعامل مع وسائل الإتصال وتحديداً ال IR ونبدأ أولاً بكيفية عمل بحث عن أجهزة ال IR الموجودة :

رمز:
 
Private Sub FindIrDADevices()
    Dim irDevices() As IrDADeviceInfo
    Dim irClient As New IrDAClient()
    ' Create a collection of a maximum of three devices.
    irDevices = irClient.DiscoverDevices(2)
    If irDevices.Length > 0 Then
            For Each device As IrDADeviceInfo In irDevices
            Next
    End If
End Sub
والآن لنرى كيفية البدء بالارسال عبر منفذ IR :

رمز:
 
    Private Sub sendIrDAData(ByVal irServiceName As String, ByVal dataFile As String)
        Dim irClient As New IrDAClient()
        Dim irDevices() As IrDADeviceInfo
        Dim buffersize As Integer = 256
        ' Create a collection of devices to discover.
        irDevices = irClient.DiscoverDevices(2)
        ' Connect to the device
        Dim irEndP As New IrDAEndPoint(irDevices(0).DeviceID, irServiceName)
        Dim irListen As New IrDAListener(irEndP)
        irListen.Start()
        irClient = irListen.AcceptIrDAClient()
        ' Open a Pocket Word file to send and get its stream.
        Dim fs As Stream
        fs = New FileStream(dataFile, FileMode.Open)
        ' Get the underlying stream of the client.
        Dim baseStream As Stream = irClient.GetStream()
        Dim length As Byte() = BitConverter.GetBytes(fs.Length)
        baseStream.Write(length, 0, length.Length)
        ' Create buffer for reading the file.
        Dim buffer(buffersize) As Byte
        Dim fileLength As Integer = CInt(fs.Length)
        ' Read the file stream into the base stream.
        While fileLength > 0
            Dim numRead As Int64 = fs.Read(buffer, 0, buffer.Length)
            baseStream.Write(buffer, 0, numRead)
            fileLength -= numRead
        End While
        fs.Close()
        baseStream.Close()
        irClient.Close()
    End Sub

ولاستقبال ارسال باستخدام IR :

رمز:
 
Private Sub writeIrDADataToFile(ByVal irServiceName As String, ByVal fileName As String)
        Dim irClient As New IrDAClient()
        Dim irDevices() As IrDADeviceInfo
        Dim buffersize As Integer = 256
        ' Create a collection of for discovering up to
        ' three devices, although only one is needed.
        irDevices = irClient.DiscoverDevices(2)
        ' Cancel if no devices are found.
        If irDevices.Length = 0 Then
            Exit Sub
        End If
        ' Connect to the first IrDA device
        Dim irEndP As New IrDAEndPoint(irDevices(0).DeviceID, irServiceName)
        irClient.Connect(irEndP)
        ' Create a stream for writing a Pocket Word file.
        Dim writeStream As Stream
        writeStream = New FileStream(fileName, FileMode.OpenOrCreate)
        ' Get the underlying stream of the client.
        Dim baseStream As Stream = irClient.GetStream()
        ' Create buffer for reading the file.
        Dim buffer(buffersize) As Byte
        Dim numToRead, numRead As Int64
        numToRead = 8
        While numToRead > 0
            numRead = baseStream.Read(buffer, 0, numToRead)
            numToRead -= numRead
        End While
        ' Get the size of the buffer to show
        ' the number of bytes to write to the file.
        numToRead = BitConverter.ToInt64(buffer, 0)
        Try
            While numToRead > 0
                numRead = baseStream.Read(buffer, 0, buffer.Length)
                numToRead -= numRead
                writeStream.Write(buffer, 0, numRead)
            End While
        Finally
            writeStream.Close()
        End Try
        baseStream.Close()
        irClient.Close()
    End Sub
بعيداً عن ال IR ، هذا الكود من أجل عمل اتصال HTTP من أجل عملية Response & Request :

رمز:
 
Dim url As String = txtURL.Text
Dim proxy As String = txtProxy.Text
Try
    If Not "".Equals(txtProxy.Text) Then
        Dim proxyObject As New WebProxy(proxy, 80)
        ' Disable proxy use when the host is local.
        proxyObject.BypassProxyOnLocal = True
        ' HTTP requests use this proxy information.
        GlobalProxySelection.Select = proxyObject
    End If
    Dim req As WebRequest = WebRequest.Create(url)
    Dim result As WebResponse = req.GetResponse()
    Dim ReceiveStream As Stream = result.GetResponseStream()
    Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
    Dim sr As New StreamReader(ReceiveStream, encode)
    ' Read the stream into arrays of 30 characters to add
    ' as items in the list box. Repeat until buffer is read.
    Dim read(29) As Char
    Dim count As Integer = sr.Read(read, 0, 30)
    While count > 0
        Dim str As New String(read, 0, count)
        lstResults.Items.Add(str)
        count = sr.Read(read, 0, 30)
    End While
Catch ex As WebException
    Dim message As String = ex.Message
    Dim response As HttpWebResponse = CType(ex.Response, HttpWebResponse)
    If response Is Nothing Then
    Else
        message = response.StatusDescription
        response.Close()
    End If
    lstResults.Items.Add(message)
Catch ex As Exception
    lstResults.Items.Add(ex.Message)
End Try
نواصل في الدرس القادم بمشيئة الله تعالى مع أوامر أخرى ...

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .

__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 14-09-07   #11
mhsnt
عضو جديد
 
تاريخ التسجيل: Aug 2007
المشاركات: 8
عدد مرات شكره للأعضاء: 0
تم شكره 0 مره في 0 مشاركه
قوة التقييم: 0
mhsnt is on a distinguished road
الافتراضي

شكراً على المجهود الكبير
mhsnt غير متصل  
قديم 16-09-07   #12
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

بسم الله الرحمن الرحيم .
السلام عليكم ورحمة الله وبركاته .


نعود في هذا الدرس مع بعض الدوال والأوامر الخاصة بالتعامل مع الأجهزة الكفية وتطبيقات ال Mobile Application .
هنا نختم سلسلة الدروس هذه بمجموعة من الأوامر البسيطة والتي ستتم من خلال VB.net و C# سوية حيث يمكنك استخدامها في عدد من التطبيقات ، أول هذه الاوامر هو كيفية معرفة اسم الجهاز :

رمز:
 
    return Dns.GetHostName()
في C# قم فقط باضافة ; في آخر السطر .

لمعرفة بعض المعلومات عن الاعدادات من ال Assembly Culture :
رمز:
 
Private Function GetCultureInfoName() As String
    Dim asm As Assembly = Assembly.GetExecutingAssembly()
    Dim ci As CultureInfo = asm.GetName().CultureInfo
    'Return the culture name in English
    return ci.EnglishName
End Function
C#:

رمز:
 
private string GetCultureInfoName()
{
    Assembly asm = Assembly.GetExecutingAssembly();
    CultureInfo ci = asm.GetName().CultureInfo;
    'Return the culture name in English
    return ci.EnglishName;
}


ولمعرفة مسار التطبيق :

رمز:
 
    return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules(0).FullyQualifiedName);
مجدداً في VB.net قم بازالة ; الموجودة في آخر السطر

وأخيراً كيفية الدخول إلى المصادر Resources :

رمز:
 
Private Sub LoadPicture()
    Dim bmpSource As Bitmap
    Dim asm As System.Reflection.Assembly
    asm = System.Reflection.Assembly.GetExecutingAssembly()
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    Try
        bmpSource = New Bitmap(asm.GetManifestResourceStream("DeviceApplication1.mypicture.bmp"))
        PictureBox1.Image = bmpSource
    Catch ex As NullReferenceException
        End Try
End Sub
C#:
رمز:
 
private void LoadPicture()
{
    Bitmap bmpSource;
    System.Reflection.Assembly As ;
    asm = System.Reflection.Assembly.GetExecutingAssembly();
    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
    Try
 {
        bmpSource = New Bitmap(asm.GetManifestResourceStream("DeviceApplication1.mypicture.bmp"));
        PictureBox1.Image = bmpSource;
 }
    Catch (NullReferenceException ex )
 {}
        
return;
}
والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .
__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 16-09-07   #13
أحمد جمال
المشـرف العـام
 
تاريخ التسجيل: May 2007
المشاركات: 4,377
عدد مرات شكره للأعضاء: 467
تم شكره 1,702 مره في 749 مشاركه
قوة التقييم: 10
أحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائعأحمد جمال عضو رائع
الافتراضي

إلى هنا نكون قد انتهينا من هذه السلسلة السريعة ، لا تنس أن بإمكانك الإطلاع على مقدمة من أجل العمل على Mobile Application من هنا :
http://vb4arab.com/vb/showthread.php?t=18

أيضاً فأغلب الدروس السابقة كانت تتم كتابتها من خلال VB.net لا تنس مراجعة هذا الدرس من أجل التحويل بين VB.net و C# :
http://www.vb4arab.com/vb/showthread.php?t=782

والله الموفق ...
والسلام عليكم ورحمة الله وبركاته .

__________________
تردد قناة الرحمة الجديد - ساهم في نشره -10873 على النايل سات - رأسي - 27500







مدونتي الشخصية والتقنية



أرجو عدم الاضافة أو المراسلة على الخاص أو البريد الالكتروني من أجل الاستفسارات البرمجية ، يفضل طرح الاستفسارات البرمجية هنا في المنتدى فقط ، في حالة وجود طلبات خاصة فقط يمكن ارسال بريد الكتروني
أحمد جمال غير متصل  
قديم 08-10-07   #14
omarfathel
عضو
 
تاريخ التسجيل: Sep 2007
المشاركات: 56
عدد مرات شكره للأعضاء: 0
تم شكره 2 مره في 2 مشاركه
قوة التقييم: 3
omarfathel is on a distinguished road
الافتراضي

مشكور على المجهود الطيب
omarfathel غير متصل  
قديم 15-10-07   #15
ranona
عضو جديد
 
تاريخ التسجيل: Jun 2007
المشاركات: 34
عدد مرات شكره للأعضاء: 0
تم شكره 1 مره في 1 مشاركه
قوة التقييم: 0
ranona is on a distinguished road
الافتراضي

ألف شكر للمجهود الرائع .. جزاك الله كل الخير .. وزادك علما ورفعة .. اللهم آمين
ranona غير متصل  
قديم 20-10-07   #16
aiash_1985
عضو جديد
 
تاريخ التسجيل: Oct 2007
المشاركات: 11
عدد مرات شكره للأعضاء: 0
تم شكره 0 مره في 0 مشاركه
قوة التقييم: 0
aiash_1985 is on a distinguished road
الافتراضي

مكتبة في قمة الروعة
حرام الواحد ما يستفيد منها
شكرا يا احمد
aiash_1985 غير متصل  
قديم 11-11-07   #17
faifah
موقوف
 
تاريخ التسجيل: Jul 2007
المشاركات: 96
عدد مرات شكره للأعضاء: 20
تم شكره 9 مره في 7 مشاركه
قوة التقييم: 0
faifah is on a distinguished road
الافتراضي

جزاك الله خير على هذا المجهود المميز
faifah غير متصل  
قديم 16-12-07   #18
المبرمجة الذكية
عضو جديد
 
تاريخ التسجيل: Dec 2007
المشاركات: 23
عدد مرات شكره للأعضاء: 0
تم شكره 0 مره في 0 مشاركه
قوة التقييم: 0
المبرمجة الذكية is on a distinguished road
الافتراضي

اشكرك على هذا المجهود الرائع أستاذ احمد جمال .. بانتظار المزيد والمزيد من عطاياك البرمجية .......
المبرمجة الذكية غير متصل  
قديم 26-11-09   #19
kachwahed
عضو جديد
 
تاريخ التسجيل: Nov 2009
المشاركات: 3
عدد مرات شكره للأعضاء: 30
تم شكره 0 مره في 0 مشاركه
قوة التقييم: 0
kachwahed is on a distinguished road
الافتراضي

السلام عليكم
بارك الله في الأخ أحمد جمال ورفع قدره
مجهود وعمل أكثر من رائع كما تعودنا منه، جزاك الله كل خير أستاذ.
فقط سؤال صغير: هل يمكن تطبيق هذه الأكواد على Windows CE ؟
kachwahed غير متصل  
قديم 09-12-09   #20
محب سيدنا النبي
عضو
 
تاريخ التسجيل: Jan 2008
المشاركات: 176
عدد مرات شكره للأعضاء: 614
تم شكره 21 مره في 20 مشاركه
قوة التقييم: 3
محب سيدنا النبي is on a distinguished road
الافتراضي

جزاك الله خيراً
__________________
اللهم صلِّ على سيدنا محمد و على آله و صحبه و سلم تسليماً كثيراً
محب سيدنا النبي غير متصل  
موضوع مغلق


يتصفح الموضوع حالياً: 1 (0 عضو و 1 ضيف)
 
أدوات الموضوع
طريقة العرض

قوانين المشاركة
لا يمكنك إضافة مواضيع
لا يمكنك إضافة ردود
لا يمكنك إضافة مرفقات
لا يمكنك تعديل مشاركاتك

رمز [IMG] متاح
رموز HTML مغلق
انتقل إلى


الساعة الآن +3: 12:05 AM.



إعلانات نصية: القرآن  الإسلام  السنة   رسول الله    صيد الفوائد طريق الإسلام   إبن باز  إبن عثيمين الإسلام سؤال وجواب  المسلم  الإسلام اليوم  البث الإسلامي    طريق القرآن   المصحف الشريف بالفلاش  رسالة الإسلام كلمات  طريق الإيمان    قناة المجد المجهر   سلطان    الراصد  البينة  البرهان  الفرقان قصة الإسلام أسرة نت دليل المواقع منتدى مكتوب

Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
هذا المنتدى يستخدم منتجات بلص
جميع الحقوق محفوظة لموقع فيجوال بيسك للعرب vb4arab.com