اذهب الي المحتوي
أوفيسنا

اداة lable شفافة مع امكانية الكتابة عمودي او افقي


SEMO.Pa3x

الردود الموصى بها

السلام عليكم: Transparent Label
من برمجة SMP3
مثال على الاداة:

lCUkqG1.png

 
 

'-----------------------------------
' Transparent Label By: SMP3
' Uploader: SEMO.Pa3x
'-----------------------------------
 
Imports System.ComponentModel
 
Public Class TransparentLabel
 
    Inherits Control
 
#Region " Fields "
    Dim m_text As String
    Dim m_style As Integer
    Dim m_opacity As Double
    Dim m_Width As Integer
    Dim m_Height As Integer
    Dim m_Color As Color
    Dim m_opacityText As Double
    Dim m_fillColor As Color = Color.Transparent
#End Region
 
#Region "Enum"
    Enum StyleX
        Vertical = 270
        Horizontal = 90
        Normal = 0
    End Enum
#End Region
 
#Region " Constructor "
 
    Public Sub New()
 
        SetStyle(ControlStyles.SupportsTransparentBackColor, True)
        UpdateStyles()
        m_opacity = 1.0R
        m_opacityText = 1.0R
 
    End Sub
 
#End Region
 
#Region " Property "
    Public Overrides Property Font() As System.Drawing.Font
        Get
 
            Return MyBase.Font
            Refresh()
        End Get
        Set(ByVal value As System.Drawing.Font)
            MyBase.Font = value
           
            DoUpdate()
 
        End Set
    End Property
    Property Style() As StyleX
        Get
            Style = m_style
            Refresh()
 
        End Get
        Set(ByVal value As StyleX)
            m_style = value
            DoUpdate()
 
        End Set
    End Property
    <System.ComponentModel.DefaultValue(0.1R)> _
    <System.ComponentModel.TypeConverter(GetType(OpacityConverter))> _
    <System.ComponentModel.Category("Panel Style")> _
    Public Property Opacity() As Double
        Get
            Return m_opacity
        End Get
        Set(ByVal value As Double)
            m_opacity = value
            UpdateStyles()
            Refresh()
        End Set
    End Property
    <System.ComponentModel.DefaultValue(1.0R)> _
    <System.ComponentModel.TypeConverter(GetType(OpacityConverter))> _
    <System.ComponentModel.Category("Panel Style")> _
    Public Property TextOpacity() As Double
        Get
            Return m_opacityText
        End Get
        Set(ByVal value As Double)
            m_opacityText = value
            UpdateStyles()
            Refresh()
        End Set
    End Property
    Public Overrides Property Text() As String
        Get
            Text = m_text
        End Get
 
        Set(ByVal value As String)
            m_text = value
            Refresh()
        End Set
    End Property
 
    <DefaultValue(GetType(Color), "Transparent")> Overrides Property ForeColor() As System.Drawing.Color
        Get
 
            ForeColor = m_Color
 
        End Get
        Set(ByVal value As System.Drawing.Color)
            m_Color = value
            Invalidate()
        End Set
    End Property
 
    <DefaultValue(GetType(Color), "Transparent")> Overrides Property BackColor() As System.Drawing.Color
        Get
            BackColor = m_fillColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            m_fillColor = value
            Invalidate()
        End Set
    End Property
    <Browsable(False), EditorBrowsable(EditorBrowsableState.Never)> _
    Public Overrides Property BackgroundImage() As System.Drawing.Image
        Get
            Return Nothing
        End Get
        Set(ByVal value As System.Drawing.Image)
            MyBase.BackgroundImage = value
        End Set
    End Property
    <Browsable(False), EditorBrowsable(EditorBrowsableState.Never)> _
    Public Overrides Property BackgroundImageLayout() As System.Windows.Forms.ImageLayout
        Get
            Return MyBase.BackgroundImageLayout
        End Get
        Set(ByVal value As System.Windows.Forms.ImageLayout)
            MyBase.BackgroundImageLayout = value
        End Set
    End Property
 
 
#End Region
 
#Region " Event "
    Protected Sub DoUpdate()
        Refresh()
        UpdateStyles()
        Invalidate()
    End Sub
 
    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Dim ExStyleX As CreateParams = MyBase.CreateParams()
            ExStyleX.ExStyle = ExStyleX.ExStyle Or &H20
            Return ExStyleX
 
        End Get
    End Property
    Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
        e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(Opacity * 255, m_fillColor)), ClientRectangle)
 
    End Sub
    Protected Overrides Sub [Select](directed As Boolean, forward As Boolean)
        'MyBase.[Select](directed, forward)
        DoUpdate()
 
    End Sub
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        MyBase.OnPaint(e)
 
        m_Height = Size.Height
        m_Width = Size.Width
        Dim G As Graphics
        G = e.Graphics
        Dim y As Single = m_Height
        Dim x As Single = m_Width
        Select Case m_style
            Case 270
                G.TranslateTransform(0, y)
                G.RotateTransform(270)
            Case 90
                G.TranslateTransform(x, 0)
                G.RotateTransform(90)
        End Select
 
        Dim NSB As New SolidBrush(Color.FromArgb(TextOpacity * 255, m_Color))
        G.DrawString(m_text, Font, NSB, 1, 1)
 
 
    End Sub
#End Region
 
End Class

 

تم تعديل بواسطه SEMO.Pa3x
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • اضف...

Important Information