تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
سؤال بعد اذنكم مش عارف استخدم الكود ده
#1
دي مقاله لقيتها بالصدفه وعجبتي بصراحه بس مش عارف استخدمها


كود :
Public Class UserProfile
    Inherits Panel
    Sub New()
        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
        Me.DoubleBuffered = True
        Me.Size = New System.Drawing.Size(200, 200)
        Me.BackColor = Color.Transparent
    End Sub
 
    Private _Linear_Gradient_Mode As Drawing2D.LinearGradientMode = Drawing2D.LinearGradientMode.Horizontal
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Linear_Gradient_Mode As Drawing2D.LinearGradientMode
        Get
            Return _Linear_Gradient_Mode
        End Get
        Set(value As Drawing2D.LinearGradientMode)
            _Linear_Gradient_Mode = value
            Me.Invalidate()
        End Set
    End Property
 
    Private _HeaderHeight As Integer = 100
    <System.ComponentModel.Category("[ Control ]")>
    Public Property HeaderHeight As Integer
        Get
            Return _HeaderHeight
        End Get
        Set(value As Integer)
            _HeaderHeight = value
            Me.Invalidate()
        End Set
    End Property
    Private _HeaderImage As Image = Nothing
    <System.ComponentModel.Category("[ Control ]")>
    Public Property HeaderImage As Image
        Get
            Return _HeaderImage
        End Get
        Set(value As Image)
            _HeaderImage = value
            Me.Invalidate()
        End Set
    End Property
    Private _CropImage As Point = New Point(0, 0)
    <System.ComponentModel.Category("[ Control ]")>
    Public Property CropImage As Point
        Get
            Return _CropImage
        End Get
        Set(value As Point)
            _CropImage = value
            Me.Invalidate()
        End Set
    End Property
    Private _Alpha As Integer = 128
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Alpha As Integer
        Get
            Return _Alpha
        End Get
        Set(value As Integer)
            If value > 255 Then value = 255
            If value < 0 Then value = 0
            _Alpha = value
            Me.Invalidate()
        End Set
    End Property
    Private _RoundEdges As Boolean = False
    <System.ComponentModel.Category("[ Control ]")>
    Public Property RoundEdges As Boolean
        Get
            Return _RoundEdges
        End Get
        Set(value As Boolean)
            _RoundEdges = value
            Me.Invalidate()
        End Set
    End Property
    Private _MarginLRB As Integer = 8
    <System.ComponentModel.Category("[ Control ]")>
    Public Property MarginLRB As Integer
        Get
            Return _MarginLRB
        End Get
        Set(value As Integer)
            _MarginLRB = value
            Me.Invalidate()
        End Set
    End Property
    Private _TopMargin As Integer = 8
    <System.ComponentModel.Category("[ Control ]")>
    Public Property TopMargin As Integer
        Get
            Return _TopMargin
        End Get
        Set(value As Integer)
            _TopMargin = value
            Me.Invalidate()
        End Set
    End Property
    Private _Radius As Integer = 12
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Radius As Integer
        Get
            Return _Radius
        End Get
        Set(value As Integer)
            If value <= 0 Then
                _Radius = 1
            Else
                _Radius = value
            End If
            Me.Invalidate()
        End Set
    End Property
 
    Private _GradientColor0 As Color = Color.Pink
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property GradientColor0 As Color
        Get
            Return _GradientColor0
        End Get
        Set(value As Color)
            _GradientColor0 = value
            Me.Invalidate()
        End Set
    End Property
    Private _GradientColor1 As Color = Color.Pink
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property GradientColor1 As Color
        Get
            Return _GradientColor1
        End Get
        Set(value As Color)
            _GradientColor1 = value
            Me.Invalidate()
        End Set
    End Property
    Private _BackgroundColor As Color = Color.Black
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property BackgroundColor As Color
        Get
            Return _BackgroundColor
        End Get
        Set(value As Color)
            _BackgroundColor = value
            Me.Invalidate()
        End Set
    End Property
    Protected Overrides Sub OnPaint(e As PaintEventArgs)
        Dim G As Graphics = e.Graphics
        With G
            .SmoothingMode = Drawing2D.SmoothingMode.HighQuality
            If HeaderImage IsNot Nothing Then
                Dim rct As New Rectangle(CropImage.X, CropImage.Y, HeaderImage.Width, HeaderHeight)
                .DrawImage(HeaderImage, New Rectangle(-1, -1, rct.Width, rct.Height), rct, GraphicsUnit.Pixel)
            End If
            Dim RC As New RectangleF(-1, -1, Me.Width + 1, HeaderHeight)
            Dim gra As New Drawing2D.LinearGradientBrush(ClientRectangle, Color.FromArgb(Alpha, GradientColor0.R, GradientColor0.G, GradientColor0.B), Color.FromArgb(Alpha, GradientColor1.R, GradientColor1.G, GradientColor1.B), Linear_Gradient_Mode)
            .FillRectangle(gra, RC)
            If RoundEdges Then
                Dim margLRB As Integer = MarginLRB
                Dim Tmarg As Integer = TopMargin
                Dim y As Integer = Me.Height - Tmarg - margLRB
                If Not y - Radius <= 0 Then
                    Dim rctx As New Rectangle(margLRB, Tmarg, Me.Width - CInt(margLRB * 2), y)
                    .FillPath(New SolidBrush(BackgroundColor), gRect(rctx, Radius))
                End If
            End If
        End With
    End Sub
    Private Function gRect(ByVal R As Rectangle, radius As Integer) As Drawing2D.GraphicsPath
        Dim GP As New Drawing2D.GraphicsPath
        GP.AddArc(R.X, R.Y, radius, radius, 180, 90)
        GP.AddArc(R.Right - radius, R.Y, radius, radius, 270, 90)
        GP.AddArc(R.Right - radius, R.Bottom - radius, radius, radius, 0, 90)
        GP.AddArc(R.X, R.Bottom - radius, radius, radius, 90, 90)
        GP.CloseFigure()
        Return GP
    End Function
End Class
كود :
Public Class UserImage
   Inherits Control
   Private State As MouseState = MouseState.None
   Private RState As RzState = RzState.f
   Private _ColorProgress As Color = Color.FromArgb(101, 204, 169)
   Private _ColorActivityStatus As Color = Color.FromArgb(101, 204, 169)
   Private _ColorBorder As Color = Color.FromArgb(190, 190, 190)
   Private _UImage As Image = Nothing
   Private _ShowImage As Boolean = False
   Private _ShowActivityStatus As Boolean = False
   Private _ShowProgress As Boolean = False
   Private _EnableHover As Boolean = False
   Private _Maximum As Integer = 100
   Private _Value As Integer = 50
   Private _StartingAngle As Integer = 70
   Private _RotationAngle As Integer = 310
   Private _BorderSize As Integer = 2
   Enum MouseState As Byte
       None = 0
       Over = 1
       Down = 2
   End Enum
   Enum RzState As Byte
       f = 0
       t = 1
   End Enum
   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorBorder As Color
       Get
           Return _ColorBorder
       End Get
       Set(value As Color)
           _ColorBorder = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorProgress As Color
       Get
           Return _ColorProgress
       End Get
       Set(value As Color)
           _ColorProgress = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorActivityStatus As Color
       Get
           Return _ColorActivityStatus
       End Get
       Set(value As Color)
           _ColorActivityStatus = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property EnableHover As Boolean
       Get
           Return _EnableHover
       End Get
       Set(value As Boolean)
           _EnableHover = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property Maximum As Integer
       Get
           Return _Maximum
       End Get
       Set(value As Integer)
           _Maximum = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property Value As Integer
       Get
           Return _Value
       End Get
       Set(value As Integer)
           _Value = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property RotationAngle As Integer
       Get
           Return _RotationAngle
       End Get
       Set(value As Integer)
           _RotationAngle = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property StartingAngle As Integer
       Get
           Return _StartingAngle
       End Get
       Set(value As Integer)
           _StartingAngle = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowProgress As Boolean
       Get
           Return _ShowProgress
       End Get
       Set(value As Boolean)
           _ShowProgress = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowActivityStatus As Boolean
       Get
           Return _ShowActivityStatus
       End Get
       Set(value As Boolean)
           _ShowActivityStatus = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowImage As Boolean
       Get
           Return _ShowImage
       End Get
       Set(value As Boolean)
           _ShowImage = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property UImage As Image
       Get
           Return _UImage
       End Get
       Set(value As Image)
           IMG = Nothing
           _UImage = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property BorderSize As Integer
       Get
           Return _BorderSize
       End Get
       Set(value As Integer)
           _BorderSize = value
           Me.Invalidate()
       End Set
   End Property

   Private _ShowBorder As Boolean = True
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowBorder As Boolean
       Get
           Return _ShowBorder
       End Get
       Set(value As Boolean)
           _ShowBorder = value
           Me.Invalidate()
       End Set
   End Property

   Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
       MyBase.OnMouseUp(e)
       State = MouseState.Over
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseEnter(e As EventArgs)
       MyBase.OnMouseEnter(e)
       State = MouseState.Over
       Me.Invalidate()
   End Sub

   Protected Overrides Sub OnMouseLeave(e As EventArgs)
       MyBase.OnMouseLeave(e)
       State = MouseState.None
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
       MyBase.OnMouseDown(e)
       State = MouseState.Down
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnResize(e As EventArgs)
       MyBase.OnResize(e)
       RState = RzState.t
       Me.Invalidate()
   End Sub
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(125, 125)
       Me.BackColor = Color.Transparent
   End Sub
   Private IMG As Image = Nothing
   Private Function ResizeImage(im As Drawing.Image, w As Int32, h As Int32) As Drawing.Bitmap
       Return ResizeImage(New Drawing.Bitmap(im), w, h)
   End Function
   Private Function ResizeImage(bm As Drawing.Bitmap, w As Int32, h As Int32) As Drawing.Bitmap
       Dim b As New Drawing.Bitmap(w, h, Drawing.Imaging.PixelFormat.Format32bppArgb)
       Dim n0, n1 As Double
       n0 = bm.Width / bm.Height
       n1 = b.Width / b.Height
       Dim x, y, wi, he As Integer
       x = 0
       y = 0
       wi = b.Width
       he = b.Height
       If n1 > n0 Then
           wi = Convert.ToInt32(Math.Floor(n0 * he))
           x = Convert.ToInt32(Math.Floor((b.Width - wi) / 2))
       Else
           he = Convert.ToInt32(Math.Floor((1 / n0) * wi))
           y = Convert.ToInt32(Math.Floor((b.Height - he) / 2))
       End If
       Using gr = Drawing.Graphics.FromImage(b)
           With gr
               .CompositingQuality = Drawing.Drawing2D.CompositingQuality.HighQuality
               .InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
               .PixelOffsetMode = Drawing.Drawing2D.PixelOffsetMode.HighQuality
               .SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
               .CompositingMode = Drawing.Drawing2D.CompositingMode.SourceOver
               .DrawImage(bm, x, y, wi, he)
           End With
       End Using
       Return b
   End Function
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       If Me.Width < 16 Or Me.Height < 16 Then
           Me.Width = 16
           Me.Height = 16
       End If
       If Not Me.Width = Me.Height Then
           Me.Width = Me.Height
       End If
       If Not Me.Dock = DockStyle.None Then
           Me.Dock = DockStyle.None
       End If
       Dim szPen As Integer = BorderSize
       Dim G As Graphics = e.Graphics
       With G
           .SmoothingMode = Drawing2D.SmoothingMode.HighQuality
           Dim clr As Color = ColorActivityStatus
           Dim xf As Color = ColorBorder
           Dim p1 As New Pen(Color.FromArgb(127, xf.R, xf.G, xf.B), szPen)
           Dim p2 As New Pen(Color.FromArgb(27, xf.R, xf.G, xf.B), szPen)
           Dim p3 As New Pen(Color.FromArgb(9, xf.R, xf.G, xf.B), szPen)
           Dim b As Bitmap
           If _ShowImage And _UImage IsNot Nothing Then
               If IMG Is Nothing Or RState = RzState.t Then
                   IMG = New Bitmap(ResizeImage(_UImage, Me.Width - 12, Me.Height - 12))
                   b = New Bitmap(IMG)
                   RState = RzState.f
               Else
                   b = New Bitmap(IMG)
               End If
           Else
               b = New Bitmap(Me.Width - 12, Me.Height - 12)
           End If
           Using bm As New Bitmap(b.Width + 12, b.Height + 12)
               Using grap As Graphics = Graphics.FromImage(bm)
                   grap.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
                   grap.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
                   Using tb As New TextureBrush(b)
                       tb.TranslateTransform(6, 6)
                       Using gp As New Drawing2D.GraphicsPath
                           gp.AddEllipse(6, 6, b.Width, b.Height)
                           grap.FillPath(tb, gp)

                           Dim X_Ell As Integer = 6
                           Dim szWidth As Integer = 12
                           Dim szHeight As Integer = 12

                           Select Case State
                               Case MouseState.Over, MouseState.Down
                                   If EnableHover Then
                                       Dim x As New Drawing2D.LinearGradientBrush(New Rectangle(3, 3, b.Width, b.Height), Color.FromArgb(0, 0, 0, 0), Color.FromArgb(80, clr.R, clr.G, clr.B), Drawing2D.LinearGradientMode.ForwardDiagonal)
                                       grap.FillEllipse(x, 6, 6, b.Width, b.Height)
                                   End If
                           End Select

                           If ShowBorder Then
                               grap.DrawEllipse(p1, X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight)
                               grap.DrawEllipse(p2, X_Ell - 1, X_Ell - 1, bm.Width - szWidth + 1, bm.Height - szHeight + 1)
                               grap.DrawEllipse(p3, X_Ell - 2, X_Ell - 2, bm.Width - szWidth + 2, bm.Height - szHeight + 2)
                           End If

                           If ShowProgress Then
                               Try
                                   Dim ProgressClr As Color = ColorProgress
                                   If Value >= Maximum Then _Value = Maximum
                                   Select Case _Value
                                       Case 0
                                       Case Maximum
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 1, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 3), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 2, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 2), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 3, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 1), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(ProgressClr), szPen), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                       Case Else
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 1, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 3), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 2, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 2), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 3, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 1), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(ProgressClr), szPen), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                   End Select
                               Catch ex As Exception
                               End Try
                           End If

                           If ShowActivityStatus Then
                               Using br As New SolidBrush(clr)
                                   Dim pi As Single = 3.14
                                   Dim m As Single = b.Width / 2
                                   Dim w As Single = m / pi
                                   Dim x, y As Single
                                   x = m * 2 - w + 6
                                   y = m * 2 - w + 6
                                   grap.FillEllipse(br, x - CInt(w / 2), y - CInt(w / 2), w, w)
                               End Using
                           End If
                       End Using
                   End Using
               End Using
               .DrawImage(bm, 0, 0)
               b.Dispose()
               bm.Dispose()
           End Using
       End With
   End Sub
End Class
كود :
Public Class _Label
   Inherits Label
   Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
       MyBase.OnTextChanged(e)
       Me.Invalidate()
   End Sub
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
               ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(90, 30)
   End Sub
   Private _IImage As Image = Nothing
   <System.ComponentModel.Category("[ Control ]")>
   Public Property IImage As Image
       Get
           Return _IImage
       End Get
       Set(value As Image)
           _IImage = value
           Me.Invalidate()
       End Set
   End Property
   Private _LeftText As Integer = 3
   <System.ComponentModel.Category("[ Control ]")>
   Public Property LeftText As Integer
       Get
           Return _LeftText
       End Get
       Set(value As Integer)
           _LeftText = value
           Me.Invalidate()
       End Set
   End Property
   Private _ImgXY As Point = New Point(0, 0)
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ImgXY As Point
       Get
           Return _ImgXY
       End Get
       Set(value As Point)
           _ImgXY = value
           Me.Invalidate()
       End Set
   End Property
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       Me.BackColor = Color.Transparent
       MyBase.OnPaint(e)
       Dim G = e.Graphics
       With G
           If IImage IsNot Nothing Then
               Dim L As Integer = ImgXY.X + IImage.Width + LeftText
               If Not Me.Padding.Left = L Then
                   Me.Padding = New System.Windows.Forms.Padding(L, 0, 0, 0)
               End If
               .DrawImage(IImage, ImgXY)
           Else
               If Me.Padding.Left > 0 Then
                   Me.Padding = New System.Windows.Forms.Padding(0, 0, 0, 0)
               End If
           End If
       End With
   End Sub
End Class
كود :
Public Class _Button
   Inherits Label
   Enum MouseState As Byte
       None = 0
       Hover = 1
   End Enum
   Private State As MouseState = MouseState.None
   Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
       MyBase.OnTextChanged(e)
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseEnter(e As EventArgs)
       MyBase.OnMouseEnter(e)
       State = MouseState.Hover
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseLeave(e As EventArgs)
       MyBase.OnMouseLeave(e)
       State = MouseState.None
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
       MyBase.OnMouseDown(e)
       State = MouseState.Hover
       Me.Invalidate()
   End Sub
   Private _ColorHover As Color = Color.Pink
   <System.ComponentModel.Category("Appearance")>
   Public Property ColorHover As Color
       Get
           Return _ColorHover
       End Get
       Set(value As Color)
           _ColorHover = value
           Me.Invalidate()
       End Set
   End Property
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
               ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(136, 51)
   End Sub
   Private Function RC(ByVal Rectangle As Rectangle) As Drawing2D.GraphicsPath
       Dim grPath As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath(Drawing2D.FillMode.Winding)
       Dim _size As New Size(5, 10)
       grPath.AddArc(_size.Width, _size.Width, Rectangle.Height - _size.Height, Rectangle.Height - _size.Height, 90, 180)
       grPath.AddLine(grPath.GetLastPoint, New Point(Rectangle.Width - grPath.GetLastPoint.X * 2 + 5, _size.Width))
       grPath.AddArc(New RectangleF(grPath.GetLastPoint, New Size(Rectangle.Height - _size.Height, Rectangle.Height - _size.Height)), 270, 180)
       grPath.CloseFigure()
       Return grPath
   End Function
   Function PenSoft(v0 As Integer, v1 As Integer, clr As Color) As Pen
       Return New Pen(Color.FromArgb(v0, clr.R, clr.G, clr.B), v1)
   End Function

   Private ColorChanged As Object = Nothing
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       MyBase.OnPaint(e)
       If Me.AutoSize = True Then Me.AutoSize = False
       If Me.Width <= 5 Then Me.Width = 6
       If Me.Height <= 10 Then Me.Height = 11
       Me.BackColor = Color.Transparent
       If Not Me.TextAlign = ContentAlignment.MiddleCenter Then Me.TextAlign = ContentAlignment.MiddleCenter
       Dim G = e.Graphics
       With G
           Dim clr As Color = Me.ForeColor
           Select Case State
               Case MouseState.None
                   clr = Me.ForeColor
                   If ColorChanged IsNot Nothing Then
                       Me.ForeColor = ColorChanged
                       ColorChanged = Nothing
                   End If
               Case MouseState.Hover
                   clr = ColorHover
                   If Not ColorHover.ToArgb = Me.ForeColor.ToArgb Then
                       ColorChanged = Me.ForeColor
                       Me.ForeColor = ColorHover
                   End If
           End Select
           .InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBilinear
           .PixelOffsetMode = Drawing.Drawing2D.PixelOffsetMode.HighQuality
           .SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
           .CompositingMode = Drawing.Drawing2D.CompositingMode.SourceOver
           Dim gp As Drawing2D.GraphicsPath = RC(Me.ClientRectangle)
           Dim m As Integer = CInt(255 / 3)
           Dim p0, p1, p2 As Pen
           p0 = PenSoft(1 * m, 3, clr)
           p1 = PenSoft(2 * m, 2, clr)
           p2 = PenSoft(3 * m, 1, clr)
           .DrawPath(p0, gp)
           .DrawPath(p1, gp)
           .DrawPath(p2, gp)
           p0.Dispose()
           p1.Dispose()
           p2.Dispose()
           gp.Dispose()
       End With
   End Sub
End Class

كل أداة لها خصائص ومميزات

أداة UserProfile

تضم جميع الأدوات بداخلها

مميزات هاذي الأداة


GradientColor0 = لأضافة تدرج لوني

GradientColor1 = لأضافة تدرج لوني

BackgroundColor = لون الخلفية

Radius = التحكم في درجة انحنى الحواف

TopMargin = التحكم في الهامش العلوي

MarginLRB = التحكم في جميع الهوامش باستثناء العلوي

RoundEdges = تمكين الحواف المستديرة

Alpha = التحكم بدرجة الشفافية

HeaderImage = لأضافة صورة في الأعلى

CropImage = لقص الصورة

HeaderHeight = التحكم في ارتفاع الصورة

Linear_Gradient_Mode = وضع التدرج


أداة UserImage

لأدخال صورة المستخدم

مميزات هاذي الأداة

UImage = اضافة صورة

ColorBorder = لون الحدود

ShowImage = تمكين الصورة

ColorProgress = لون التقدم

ColorActivityStatus = لون نشاط المستخدم

EnableHover = تمكين لون تدرج عند مرور الماوس على الصورة

RotationAngle = زاوية الدوران

StartingAngle = بداية زاوية الدوران

ShowProgress = تمكين شريط التقدم

ShowActivityStatus = تمكين لون نشاط المستخدم

ShowImage = تمكين الصورة

BorderSize = حجم الحدود

ShowBorder = تمكين الحدود

أداة _Label

مميزات

IImage = اضافة صورة

LeftText = التحكم في التفاف النص من اليسار

ImgXY = التحكم في موقع الصورة

اداة _Button

لم اضف اي خصائص غير اللوان فقط






الخط Alfabetica

vb.SRC


_________________________
أستخدم الكود ازاي بعد اذنكم
الرد
تم الشكر بواسطة: جميل5
#2
(20-01-20, 04:52 AM)اليوم السابع كتب : دي مقاله لقيتها بالصدفه وعجبتي بصراحه بس مش عارف استخدمها


كود :
Public Class UserProfile
    Inherits Panel
    Sub New()
        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
        Me.DoubleBuffered = True
        Me.Size = New System.Drawing.Size(200, 200)
        Me.BackColor = Color.Transparent
    End Sub
 
    Private _Linear_Gradient_Mode As Drawing2D.LinearGradientMode = Drawing2D.LinearGradientMode.Horizontal
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Linear_Gradient_Mode As Drawing2D.LinearGradientMode
        Get
            Return _Linear_Gradient_Mode
        End Get
        Set(value As Drawing2D.LinearGradientMode)
            _Linear_Gradient_Mode = value
            Me.Invalidate()
        End Set
    End Property
 
    Private _HeaderHeight As Integer = 100
    <System.ComponentModel.Category("[ Control ]")>
    Public Property HeaderHeight As Integer
        Get
            Return _HeaderHeight
        End Get
        Set(value As Integer)
            _HeaderHeight = value
            Me.Invalidate()
        End Set
    End Property
    Private _HeaderImage As Image = Nothing
    <System.ComponentModel.Category("[ Control ]")>
    Public Property HeaderImage As Image
        Get
            Return _HeaderImage
        End Get
        Set(value As Image)
            _HeaderImage = value
            Me.Invalidate()
        End Set
    End Property
    Private _CropImage As Point = New Point(0, 0)
    <System.ComponentModel.Category("[ Control ]")>
    Public Property CropImage As Point
        Get
            Return _CropImage
        End Get
        Set(value As Point)
            _CropImage = value
            Me.Invalidate()
        End Set
    End Property
    Private _Alpha As Integer = 128
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Alpha As Integer
        Get
            Return _Alpha
        End Get
        Set(value As Integer)
            If value > 255 Then value = 255
            If value < 0 Then value = 0
            _Alpha = value
            Me.Invalidate()
        End Set
    End Property
    Private _RoundEdges As Boolean = False
    <System.ComponentModel.Category("[ Control ]")>
    Public Property RoundEdges As Boolean
        Get
            Return _RoundEdges
        End Get
        Set(value As Boolean)
            _RoundEdges = value
            Me.Invalidate()
        End Set
    End Property
    Private _MarginLRB As Integer = 8
    <System.ComponentModel.Category("[ Control ]")>
    Public Property MarginLRB As Integer
        Get
            Return _MarginLRB
        End Get
        Set(value As Integer)
            _MarginLRB = value
            Me.Invalidate()
        End Set
    End Property
    Private _TopMargin As Integer = 8
    <System.ComponentModel.Category("[ Control ]")>
    Public Property TopMargin As Integer
        Get
            Return _TopMargin
        End Get
        Set(value As Integer)
            _TopMargin = value
            Me.Invalidate()
        End Set
    End Property
    Private _Radius As Integer = 12
    <System.ComponentModel.Category("[ Control ]")>
    Public Property Radius As Integer
        Get
            Return _Radius
        End Get
        Set(value As Integer)
            If value <= 0 Then
                _Radius = 1
            Else
                _Radius = value
            End If
            Me.Invalidate()
        End Set
    End Property
 
    Private _GradientColor0 As Color = Color.Pink
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property GradientColor0 As Color
        Get
            Return _GradientColor0
        End Get
        Set(value As Color)
            _GradientColor0 = value
            Me.Invalidate()
        End Set
    End Property
    Private _GradientColor1 As Color = Color.Pink
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property GradientColor1 As Color
        Get
            Return _GradientColor1
        End Get
        Set(value As Color)
            _GradientColor1 = value
            Me.Invalidate()
        End Set
    End Property
    Private _BackgroundColor As Color = Color.Black
    <System.ComponentModel.Category("[ Colors ]")>
    Public Property BackgroundColor As Color
        Get
            Return _BackgroundColor
        End Get
        Set(value As Color)
            _BackgroundColor = value
            Me.Invalidate()
        End Set
    End Property
    Protected Overrides Sub OnPaint(e As PaintEventArgs)
        Dim G As Graphics = e.Graphics
        With G
            .SmoothingMode = Drawing2D.SmoothingMode.HighQuality
            If HeaderImage IsNot Nothing Then
                Dim rct As New Rectangle(CropImage.X, CropImage.Y, HeaderImage.Width, HeaderHeight)
                .DrawImage(HeaderImage, New Rectangle(-1, -1, rct.Width, rct.Height), rct, GraphicsUnit.Pixel)
            End If
            Dim RC As New RectangleF(-1, -1, Me.Width + 1, HeaderHeight)
            Dim gra As New Drawing2D.LinearGradientBrush(ClientRectangle, Color.FromArgb(Alpha, GradientColor0.R, GradientColor0.G, GradientColor0.B), Color.FromArgb(Alpha, GradientColor1.R, GradientColor1.G, GradientColor1.B), Linear_Gradient_Mode)
            .FillRectangle(gra, RC)
            If RoundEdges Then
                Dim margLRB As Integer = MarginLRB
                Dim Tmarg As Integer = TopMargin
                Dim y As Integer = Me.Height - Tmarg - margLRB
                If Not y - Radius <= 0 Then
                    Dim rctx As New Rectangle(margLRB, Tmarg, Me.Width - CInt(margLRB * 2), y)
                    .FillPath(New SolidBrush(BackgroundColor), gRect(rctx, Radius))
                End If
            End If
        End With
    End Sub
    Private Function gRect(ByVal R As Rectangle, radius As Integer) As Drawing2D.GraphicsPath
        Dim GP As New Drawing2D.GraphicsPath
        GP.AddArc(R.X, R.Y, radius, radius, 180, 90)
        GP.AddArc(R.Right - radius, R.Y, radius, radius, 270, 90)
        GP.AddArc(R.Right - radius, R.Bottom - radius, radius, radius, 0, 90)
        GP.AddArc(R.X, R.Bottom - radius, radius, radius, 90, 90)
        GP.CloseFigure()
        Return GP
    End Function
End Class
كود :
Public Class UserImage
   Inherits Control
   Private State As MouseState = MouseState.None
   Private RState As RzState = RzState.f
   Private _ColorProgress As Color = Color.FromArgb(101, 204, 169)
   Private _ColorActivityStatus As Color = Color.FromArgb(101, 204, 169)
   Private _ColorBorder As Color = Color.FromArgb(190, 190, 190)
   Private _UImage As Image = Nothing
   Private _ShowImage As Boolean = False
   Private _ShowActivityStatus As Boolean = False
   Private _ShowProgress As Boolean = False
   Private _EnableHover As Boolean = False
   Private _Maximum As Integer = 100
   Private _Value As Integer = 50
   Private _StartingAngle As Integer = 70
   Private _RotationAngle As Integer = 310
   Private _BorderSize As Integer = 2
   Enum MouseState As Byte
       None = 0
       Over = 1
       Down = 2
   End Enum
   Enum RzState As Byte
       f = 0
       t = 1
   End Enum
   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorBorder As Color
       Get
           Return _ColorBorder
       End Get
       Set(value As Color)
           _ColorBorder = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorProgress As Color
       Get
           Return _ColorProgress
       End Get
       Set(value As Color)
           _ColorProgress = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Colors ]")>
   Public Property ColorActivityStatus As Color
       Get
           Return _ColorActivityStatus
       End Get
       Set(value As Color)
           _ColorActivityStatus = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property EnableHover As Boolean
       Get
           Return _EnableHover
       End Get
       Set(value As Boolean)
           _EnableHover = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property Maximum As Integer
       Get
           Return _Maximum
       End Get
       Set(value As Integer)
           _Maximum = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property Value As Integer
       Get
           Return _Value
       End Get
       Set(value As Integer)
           _Value = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property RotationAngle As Integer
       Get
           Return _RotationAngle
       End Get
       Set(value As Integer)
           _RotationAngle = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property StartingAngle As Integer
       Get
           Return _StartingAngle
       End Get
       Set(value As Integer)
           _StartingAngle = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowProgress As Boolean
       Get
           Return _ShowProgress
       End Get
       Set(value As Boolean)
           _ShowProgress = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowActivityStatus As Boolean
       Get
           Return _ShowActivityStatus
       End Get
       Set(value As Boolean)
           _ShowActivityStatus = value
           Me.Invalidate()
       End Set
   End Property
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowImage As Boolean
       Get
           Return _ShowImage
       End Get
       Set(value As Boolean)
           _ShowImage = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property UImage As Image
       Get
           Return _UImage
       End Get
       Set(value As Image)
           IMG = Nothing
           _UImage = value
           Me.Invalidate()
       End Set
   End Property

   <System.ComponentModel.Category("[ Control ]")>
   Public Property BorderSize As Integer
       Get
           Return _BorderSize
       End Get
       Set(value As Integer)
           _BorderSize = value
           Me.Invalidate()
       End Set
   End Property

   Private _ShowBorder As Boolean = True
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ShowBorder As Boolean
       Get
           Return _ShowBorder
       End Get
       Set(value As Boolean)
           _ShowBorder = value
           Me.Invalidate()
       End Set
   End Property

   Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
       MyBase.OnMouseUp(e)
       State = MouseState.Over
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseEnter(e As EventArgs)
       MyBase.OnMouseEnter(e)
       State = MouseState.Over
       Me.Invalidate()
   End Sub

   Protected Overrides Sub OnMouseLeave(e As EventArgs)
       MyBase.OnMouseLeave(e)
       State = MouseState.None
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
       MyBase.OnMouseDown(e)
       State = MouseState.Down
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnResize(e As EventArgs)
       MyBase.OnResize(e)
       RState = RzState.t
       Me.Invalidate()
   End Sub
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(125, 125)
       Me.BackColor = Color.Transparent
   End Sub
   Private IMG As Image = Nothing
   Private Function ResizeImage(im As Drawing.Image, w As Int32, h As Int32) As Drawing.Bitmap
       Return ResizeImage(New Drawing.Bitmap(im), w, h)
   End Function
   Private Function ResizeImage(bm As Drawing.Bitmap, w As Int32, h As Int32) As Drawing.Bitmap
       Dim b As New Drawing.Bitmap(w, h, Drawing.Imaging.PixelFormat.Format32bppArgb)
       Dim n0, n1 As Double
       n0 = bm.Width / bm.Height
       n1 = b.Width / b.Height
       Dim x, y, wi, he As Integer
       x = 0
       y = 0
       wi = b.Width
       he = b.Height
       If n1 > n0 Then
           wi = Convert.ToInt32(Math.Floor(n0 * he))
           x = Convert.ToInt32(Math.Floor((b.Width - wi) / 2))
       Else
           he = Convert.ToInt32(Math.Floor((1 / n0) * wi))
           y = Convert.ToInt32(Math.Floor((b.Height - he) / 2))
       End If
       Using gr = Drawing.Graphics.FromImage(b)
           With gr
               .CompositingQuality = Drawing.Drawing2D.CompositingQuality.HighQuality
               .InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
               .PixelOffsetMode = Drawing.Drawing2D.PixelOffsetMode.HighQuality
               .SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
               .CompositingMode = Drawing.Drawing2D.CompositingMode.SourceOver
               .DrawImage(bm, x, y, wi, he)
           End With
       End Using
       Return b
   End Function
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       If Me.Width < 16 Or Me.Height < 16 Then
           Me.Width = 16
           Me.Height = 16
       End If
       If Not Me.Width = Me.Height Then
           Me.Width = Me.Height
       End If
       If Not Me.Dock = DockStyle.None Then
           Me.Dock = DockStyle.None
       End If
       Dim szPen As Integer = BorderSize
       Dim G As Graphics = e.Graphics
       With G
           .SmoothingMode = Drawing2D.SmoothingMode.HighQuality
           Dim clr As Color = ColorActivityStatus
           Dim xf As Color = ColorBorder
           Dim p1 As New Pen(Color.FromArgb(127, xf.R, xf.G, xf.B), szPen)
           Dim p2 As New Pen(Color.FromArgb(27, xf.R, xf.G, xf.B), szPen)
           Dim p3 As New Pen(Color.FromArgb(9, xf.R, xf.G, xf.B), szPen)
           Dim b As Bitmap
           If _ShowImage And _UImage IsNot Nothing Then
               If IMG Is Nothing Or RState = RzState.t Then
                   IMG = New Bitmap(ResizeImage(_UImage, Me.Width - 12, Me.Height - 12))
                   b = New Bitmap(IMG)
                   RState = RzState.f
               Else
                   b = New Bitmap(IMG)
               End If
           Else
               b = New Bitmap(Me.Width - 12, Me.Height - 12)
           End If
           Using bm As New Bitmap(b.Width + 12, b.Height + 12)
               Using grap As Graphics = Graphics.FromImage(bm)
                   grap.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
                   grap.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
                   Using tb As New TextureBrush(b)
                       tb.TranslateTransform(6, 6)
                       Using gp As New Drawing2D.GraphicsPath
                           gp.AddEllipse(6, 6, b.Width, b.Height)
                           grap.FillPath(tb, gp)

                           Dim X_Ell As Integer = 6
                           Dim szWidth As Integer = 12
                           Dim szHeight As Integer = 12

                           Select Case State
                               Case MouseState.Over, MouseState.Down
                                   If EnableHover Then
                                       Dim x As New Drawing2D.LinearGradientBrush(New Rectangle(3, 3, b.Width, b.Height), Color.FromArgb(0, 0, 0, 0), Color.FromArgb(80, clr.R, clr.G, clr.B), Drawing2D.LinearGradientMode.ForwardDiagonal)
                                       grap.FillEllipse(x, 6, 6, b.Width, b.Height)
                                   End If
                           End Select

                           If ShowBorder Then
                               grap.DrawEllipse(p1, X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight)
                               grap.DrawEllipse(p2, X_Ell - 1, X_Ell - 1, bm.Width - szWidth + 1, bm.Height - szHeight + 1)
                               grap.DrawEllipse(p3, X_Ell - 2, X_Ell - 2, bm.Width - szWidth + 2, bm.Height - szHeight + 2)
                           End If

                           If ShowProgress Then
                               Try
                                   Dim ProgressClr As Color = ColorProgress
                                   If Value >= Maximum Then _Value = Maximum
                                   Select Case _Value
                                       Case 0
                                       Case Maximum
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 1, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 3), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 2, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 2), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 3, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 1), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                           grap.DrawArc(New Pen(New SolidBrush(ProgressClr), szPen), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, RotationAngle)
                                       Case Else
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 1, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 3), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 2, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 2), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(Color.FromArgb(6 * 3, ProgressClr.R, ProgressClr.G, ProgressClr.B)), szPen + 1), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                           grap.DrawArc(New Pen(New SolidBrush(ProgressClr), szPen), X_Ell, X_Ell, bm.Width - szWidth, bm.Height - szHeight, StartingAngle, CInt((RotationAngle / Maximum) * Value))
                                   End Select
                               Catch ex As Exception
                               End Try
                           End If

                           If ShowActivityStatus Then
                               Using br As New SolidBrush(clr)
                                   Dim pi As Single = 3.14
                                   Dim m As Single = b.Width / 2
                                   Dim w As Single = m / pi
                                   Dim x, y As Single
                                   x = m * 2 - w + 6
                                   y = m * 2 - w + 6
                                   grap.FillEllipse(br, x - CInt(w / 2), y - CInt(w / 2), w, w)
                               End Using
                           End If
                       End Using
                   End Using
               End Using
               .DrawImage(bm, 0, 0)
               b.Dispose()
               bm.Dispose()
           End Using
       End With
   End Sub
End Class
كود :
Public Class _Label
   Inherits Label
   Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
       MyBase.OnTextChanged(e)
       Me.Invalidate()
   End Sub
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
               ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(90, 30)
   End Sub
   Private _IImage As Image = Nothing
   <System.ComponentModel.Category("[ Control ]")>
   Public Property IImage As Image
       Get
           Return _IImage
       End Get
       Set(value As Image)
           _IImage = value
           Me.Invalidate()
       End Set
   End Property
   Private _LeftText As Integer = 3
   <System.ComponentModel.Category("[ Control ]")>
   Public Property LeftText As Integer
       Get
           Return _LeftText
       End Get
       Set(value As Integer)
           _LeftText = value
           Me.Invalidate()
       End Set
   End Property
   Private _ImgXY As Point = New Point(0, 0)
   <System.ComponentModel.Category("[ Control ]")>
   Public Property ImgXY As Point
       Get
           Return _ImgXY
       End Get
       Set(value As Point)
           _ImgXY = value
           Me.Invalidate()
       End Set
   End Property
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       Me.BackColor = Color.Transparent
       MyBase.OnPaint(e)
       Dim G = e.Graphics
       With G
           If IImage IsNot Nothing Then
               Dim L As Integer = ImgXY.X + IImage.Width + LeftText
               If Not Me.Padding.Left = L Then
                   Me.Padding = New System.Windows.Forms.Padding(L, 0, 0, 0)
               End If
               .DrawImage(IImage, ImgXY)
           Else
               If Me.Padding.Left > 0 Then
                   Me.Padding = New System.Windows.Forms.Padding(0, 0, 0, 0)
               End If
           End If
       End With
   End Sub
End Class
كود :
Public Class _Button
   Inherits Label
   Enum MouseState As Byte
       None = 0
       Hover = 1
   End Enum
   Private State As MouseState = MouseState.None
   Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
       MyBase.OnTextChanged(e)
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseEnter(e As EventArgs)
       MyBase.OnMouseEnter(e)
       State = MouseState.Hover
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseLeave(e As EventArgs)
       MyBase.OnMouseLeave(e)
       State = MouseState.None
       Me.Invalidate()
   End Sub
   Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
       MyBase.OnMouseDown(e)
       State = MouseState.Hover
       Me.Invalidate()
   End Sub
   Private _ColorHover As Color = Color.Pink
   <System.ComponentModel.Category("Appearance")>
   Public Property ColorHover As Color
       Get
           Return _ColorHover
       End Get
       Set(value As Color)
           _ColorHover = value
           Me.Invalidate()
       End Set
   End Property
   Sub New()
       SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
               ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
               ControlStyles.SupportsTransparentBackColor, True)
       Me.DoubleBuffered = True
       Me.Size = New System.Drawing.Size(136, 51)
   End Sub
   Private Function RC(ByVal Rectangle As Rectangle) As Drawing2D.GraphicsPath
       Dim grPath As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath(Drawing2D.FillMode.Winding)
       Dim _size As New Size(5, 10)
       grPath.AddArc(_size.Width, _size.Width, Rectangle.Height - _size.Height, Rectangle.Height - _size.Height, 90, 180)
       grPath.AddLine(grPath.GetLastPoint, New Point(Rectangle.Width - grPath.GetLastPoint.X * 2 + 5, _size.Width))
       grPath.AddArc(New RectangleF(grPath.GetLastPoint, New Size(Rectangle.Height - _size.Height, Rectangle.Height - _size.Height)), 270, 180)
       grPath.CloseFigure()
       Return grPath
   End Function
   Function PenSoft(v0 As Integer, v1 As Integer, clr As Color) As Pen
       Return New Pen(Color.FromArgb(v0, clr.R, clr.G, clr.B), v1)
   End Function

   Private ColorChanged As Object = Nothing
   Protected Overrides Sub OnPaint(e As PaintEventArgs)
       MyBase.OnPaint(e)
       If Me.AutoSize = True Then Me.AutoSize = False
       If Me.Width <= 5 Then Me.Width = 6
       If Me.Height <= 10 Then Me.Height = 11
       Me.BackColor = Color.Transparent
       If Not Me.TextAlign = ContentAlignment.MiddleCenter Then Me.TextAlign = ContentAlignment.MiddleCenter
       Dim G = e.Graphics
       With G
           Dim clr As Color = Me.ForeColor
           Select Case State
               Case MouseState.None
                   clr = Me.ForeColor
                   If ColorChanged IsNot Nothing Then
                       Me.ForeColor = ColorChanged
                       ColorChanged = Nothing
                   End If
               Case MouseState.Hover
                   clr = ColorHover
                   If Not ColorHover.ToArgb = Me.ForeColor.ToArgb Then
                       ColorChanged = Me.ForeColor
                       Me.ForeColor = ColorHover
                   End If
           End Select
           .InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBilinear
           .PixelOffsetMode = Drawing.Drawing2D.PixelOffsetMode.HighQuality
           .SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
           .CompositingMode = Drawing.Drawing2D.CompositingMode.SourceOver
           Dim gp As Drawing2D.GraphicsPath = RC(Me.ClientRectangle)
           Dim m As Integer = CInt(255 / 3)
           Dim p0, p1, p2 As Pen
           p0 = PenSoft(1 * m, 3, clr)
           p1 = PenSoft(2 * m, 2, clr)
           p2 = PenSoft(3 * m, 1, clr)
           .DrawPath(p0, gp)
           .DrawPath(p1, gp)
           .DrawPath(p2, gp)
           p0.Dispose()
           p1.Dispose()
           p2.Dispose()
           gp.Dispose()
       End With
   End Sub
End Class

كل أداة لها خصائص ومميزات

أداة UserProfile

تضم جميع الأدوات بداخلها

مميزات هاذي الأداة


GradientColor0 = لأضافة تدرج لوني

GradientColor1 = لأضافة تدرج لوني

BackgroundColor = لون الخلفية

Radius = التحكم في درجة انحنى الحواف

TopMargin = التحكم في الهامش العلوي

MarginLRB = التحكم في جميع الهوامش باستثناء العلوي

RoundEdges = تمكين الحواف المستديرة

Alpha = التحكم بدرجة الشفافية

HeaderImage = لأضافة صورة في الأعلى

CropImage = لقص الصورة

HeaderHeight = التحكم في ارتفاع الصورة

Linear_Gradient_Mode = وضع التدرج


أداة UserImage

لأدخال صورة المستخدم

مميزات هاذي الأداة

UImage = اضافة صورة

ColorBorder = لون الحدود

ShowImage = تمكين الصورة

ColorProgress = لون التقدم

ColorActivityStatus = لون نشاط المستخدم

EnableHover = تمكين لون تدرج عند مرور الماوس على الصورة

RotationAngle = زاوية الدوران

StartingAngle = بداية زاوية الدوران

ShowProgress = تمكين شريط التقدم

ShowActivityStatus = تمكين لون نشاط المستخدم

ShowImage = تمكين الصورة

BorderSize = حجم الحدود

ShowBorder = تمكين الحدود

أداة _Label

مميزات

IImage = اضافة صورة

LeftText = التحكم في التفاف النص من اليسار

ImgXY = التحكم في موقع الصورة

اداة _Button

لم اضف اي خصائص غير اللوان فقط






الخط Alfabetica

vb.SRC


_________________________
أستخدم الكود ازاي بعد اذنكم

؟؟؟؟
الرد
تم الشكر بواسطة: جميل5
#3
بسم الله الرحمن الرحيم .
أنشئ مشروع جديد و اضف اليه كلاس عدد 4 بالمسميات التالية :

UserProfile
UserImage
_Label
_Button

و انسخ الاكواد الى الكلاسات حسب الاسم ثم اعمل ريبلد او بليد للمشروع و انظر الى قائمة الادوات في الاعلى ستجد اربع ادوات جديدة .

موفق انشاء الله .
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر




الرد
#4
(20-01-20, 04:58 PM)asemshahen5 كتب : بسم الله الرحمن الرحيم .
أنشئ مشروع جديد و اضف اليه كلاس عدد 4 بالمسميات التالية :

UserProfile
UserImage
_Label
_Button

و انسخ الاكواد الى الكلاسات حسب الاسم ثم اعمل ريبلد او بليد للمشروع و انظر الى قائمة الادوات في الاعلى ستجد اربع ادوات جديدة .

موفق انشاء الله .

عاصم اخويا الكبير والمحترم والله العظيم بس معلش اعمل ازاي ريبلد او بليد
الرد
تم الشكر بواسطة: asemshahen5 , جميل5
#5
إضغط بالزر الايمن للماوس على المشروع في مستعرض المشروع و اختار ريبلد او بيلد .

و الله الموفق .
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر




الرد
#6
أو باختصار .. الضغط على
F5
الرد
تم الشكر بواسطة: asemshahen5 , اليوم السابع , جميل5


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  سؤال فى الكريستال mmali127 0 80 12-11-20, 01:20 PM
آخر رد: mmali127
  ممكن تعديل علي الكود ليكون بشكل صحيح modywassem520 6 217 06-11-20, 11:16 PM
آخر رد: سعود
  سؤال بخصوص الضريبة و الخصم في الفاتورة sofiane-phy 2 165 30-10-20, 11:06 PM
آخر رد: sofiane-phy
  تعديل الكود عمور2016 5 268 30-10-20, 12:29 AM
آخر رد: lafi
  سؤال في Html Agility Pack اليوم السابع 0 149 27-10-20, 07:55 PM
آخر رد: اليوم السابع
  [VB.NET] سؤال في geckowebbrowser farfour 2 139 25-10-20, 03:49 PM
آخر رد: farfour
  [VB.NET] سؤال في webbrowser farfour 6 295 24-10-20, 05:35 PM
آخر رد: farfour
  سؤال في التشيك بوكس اليوم السابع 3 164 24-10-20, 03:44 AM
آخر رد: kiki
  [VB.NET] سؤال توضيحي حول الحفظ عن طريق CommandBuilder larbihamri 2 247 19-10-20, 10:07 AM
آخر رد: larbihamri
  سؤال في listbox KIKO1992 2 183 13-10-20, 12:28 AM
آخر رد: KIKO1992

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم