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

نسخة كاملة : تعديل على كود take ScreenShot
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
انا عندي أداة SplitContainer1 و اداة SplitContainer1.planel2
دخلها AxWindowsMediaPlayer1
في اريد التعديل كود بدل ان يصور شاشه كامله , اريد ان يصور داخل اداه SplitContainer1.planel2 ما عرض فيها يعرض فيها AxWindowsMediaPlayer1 اي ان سوف يصور مايعمل داخل اداه AxWindowsMediaPlayer1 ,, مع مرعات تغير في حجم الفورم , هل ممكن ذلك ؟
كود :
Imports System.Drawing.Graphics

Dim path As String = String.Empty


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim saveFile As String = path & ".jpg"

        Dim screenSize As New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)

        Dim capImage As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)

        Dim graph As Graphics = Graphics.FromImage(capImage)

        graph.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenSize)

        capImage.Save(saveFile)

        MsgBox("Saved File To : " & saveFile) 'Showing the whole path where capturedImage is saved

        Process.Start(saveFile) 'Showing The Captured Image In Windows Image Viewer
    End Sub
ممكن تعديل بسيط للفكرة حيث تستخدم الفورم كاطار تصوير وتلونه بلون تجعله transparentkey
او ممكن تستبدل
كود :
My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height
بعرض الاداة وارتفاعها
السلام عليكم،
أستبدل كودك بالكود التالي:
كود :
Dim saveFile As String = path & ".jpg"
        Dim cropSize As Size = AxWindowsMediaPlayer1.Size
        Dim croppedImage As New Bitmap(AxWindowsMediaPlayer1.Size.Width, AxWindowsMediaPlayer1.Size.Height)
        Dim G As Graphics = Graphics.FromImage(croppedImage)
        G.CopyFromScreen(AxWindowsMediaPlayer1.PointToScreen(Nothing), Nothing, cropSize)
        PictureBox1.Image = croppedImage
        croppedImage.Save(saveFile)
        MsgBox("Saved File To : " & saveFile) 'Showing the whole path where capturedImage is saved
        Process.Start(saveFile) 'Showing The Captured Image In Windows Image Viewer
الله يعطيكم العافية يااخواني كرام
شكرا لك يااخي Aly El-Haddad على كود 100%
الله بيارك وقتك وجميعاااا لكم