منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[سؤال] جعل خلفية اداة RichTextBox صورة - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [سؤال] جعل خلفية اداة RichTextBox صورة (/showthread.php?tid=13637)



جعل خلفية اداة RichTextBox صورة - mina250 - 28-10-15

شباب اريد جعل  اداة RichTextBox صورة
ضرورى
المطلوب بالتفصيل ان يكون لدي اداة RichTextBox  خلفية بمعنى ان يكون ظاهر خلف النص صورة 
Huh Huh Huh Huh



RE: جعل خلفية اداة RichTextBox صورة - HASAN6.0 - 28-10-15

جرب اضافة كلاس
كود :
Public Class OpaqueRichTextBox
   Inherits RichTextBox

   Private Shared ReadOnly DefaultBackground As Color = Color.Transparent
   Private TransparentImage As Image

   Public Sub New()
       Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
       Me.SetStyle(ControlStyles.Opaque, True)
       Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
       BackColor = DefaultBackground
   End Sub

   Public Overrides Property BackColor() As System.Drawing.Color
       Get
           Return MyBase.BackColor
       End Get
       Set(ByVal value As System.Drawing.Color)
           MyBase.BackColor = value
       End Set
   End Property

   Public Property Image() As Image
       Get
           Return TransparentImage
       End Get
       Set(ByVal value As Image)
           TransparentImage = value
           Invalidate()
       End Set
   End Property

   Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
       Get
           Dim cp As CreateParams = MyBase.CreateParams
           cp.ExStyle = cp.ExStyle Or &H20
           Return cp
       End Get
   End Property

   ' Infrastructure to cause the default background to be transparent
   Public Function ShouldSerializeBackColor() As Boolean
       Return BackColor = DefaultBackground
   End Function

   ' Infrastructure to cause the default background to be transparent
   Public Sub ResetBackground()
       BackColor = DefaultBackground
   End Sub

End Class


ووضع الصورة خلف التيكست


RE: جعل خلفية اداة RichTextBox صورة - mina250 - 29-10-15

(28-10-15, 11:23 PM)HASAN6.0 كتب : جرب اضافة كلاس
كود :
Public Class OpaqueRichTextBox
   Inherits RichTextBox

   Private Shared ReadOnly DefaultBackground As Color = Color.Transparent
   Private TransparentImage As Image

   Public Sub New()
       Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
       Me.SetStyle(ControlStyles.Opaque, True)
       Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
       BackColor = DefaultBackground
   End Sub

   Public Overrides Property BackColor() As System.Drawing.Color
       Get
           Return MyBase.BackColor
       End Get
       Set(ByVal value As System.Drawing.Color)
           MyBase.BackColor = value
       End Set
   End Property

   Public Property Image() As Image
       Get
           Return TransparentImage
       End Get
       Set(ByVal value As Image)
           TransparentImage = value
           Invalidate()
       End Set
   End Property

   Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
       Get
           Dim cp As CreateParams = MyBase.CreateParams
           cp.ExStyle = cp.ExStyle Or &H20
           Return cp
       End Get
   End Property

   ' Infrastructure to cause the default background to be transparent
   Public Function ShouldSerializeBackColor() As Boolean
       Return BackColor = DefaultBackground
   End Function

   ' Infrastructure to cause the default background to be transparent
   Public Sub ResetBackground()
       BackColor = DefaultBackground
   End Sub

End Class


ووضع الصورة خلف التيكست

شكرا اخى
ولكن الكود به مشكلة  Sad



RE: جعل خلفية اداة RichTextBox صورة - silverlight - 29-10-15

أنصحك أن لا تستخدم هذا الاسلوب خاصة أن التغيير في مثل هذه الانواع من الكونترول باستخدام الجرافكس له مشاكل لا حصر لها و هذا ما جعل مايكروسوفت تصمم الكونترول بمثل هذه الطريقة أصلا