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

نسخة كاملة : كيف اجعل PictureBox شفافة
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الصفحات : 1 2
~
مالحل ايها الاخوة
هفففففففففففففففففففففف
السلام عليكم فية حل كويس للموضوع دة بعد اذن الشباب طبعا

1-تنشيء Class جديد وتخلي اسمة TransparentPictureBox

2-بعد كدا حط الكود دة داخل ال Class
كود :
Public Class TransparentPictureBox
   Inherits PictureBox
   Protected Overrides Sub OnPaintBackground(e As System.Windows.Forms.PaintEventArgs)
       MyBase.OnPaintBackground(e)

       If Parent IsNot Nothing Then
           Dim index As Integer = Parent.Controls.GetChildIndex(Me)

           For i As Integer = Parent.Controls.Count - 1 To index + 1 Step -1
               Dim c As Control = Parent.Controls(i)
               If c.Bounds.IntersectsWith(Bounds) AndAlso c.Visible = True Then
                   Dim bmp As New Bitmap(c.Width, c.Height, e.Graphics)
                   c.DrawToBitmap(bmp, c.ClientRectangle)
                   e.Graphics.TranslateTransform(c.Left - Left, c.Top - Top)
                   e.Graphics.DrawImageUnscaled(bmp, Point.Empty)
                   e.Graphics.TranslateTransform(Left - c.Left, Top - c.Top)
                   bmp.Dispose()
               End If
           Next
       End If
   End Sub
End Class

3- اعمل Build للمشروع
4-هتروح على ToolBox هتلاقي اداة جديدة اسمها  TransparentPictureBox
5- اسحب الاداة على الفورم واضيف ليها الصورة الي انت عاوزها
الصفحات : 1 2