mtControls

Please post all your completed software applications in here. This is for full software which you have created and wish to release and share with everyone.
13 posts Page 2 of 2
Contributors
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: mtControls
MrAksel
I have a similar library but I haven't uploaded it to CnS because I didn't think it was that useful, but it's really okay to gather all the cool components you know about in one DLL !
But it didn't work so I use mine instead, I got the same error as code it.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: mtControls
XTechVB
[quote="code it"]Doesn't work for me(circle pro bar)

create a new project
add the dll to your toolbox
debug the project without any controls on the form (close the project)
now add any controls you want and debug again

Now everything should work
You can find me on Facebook or on Skype mihai_92b
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: mtControls
code it
I still get the same error

EDIT:NVM works now(just added the code)
Code: Select all
    Imports System.Drawing.Drawing2D
    Public Class Circle_Pro_Bar : Inherits Control

        Sub New()
            Size = New Size(100, 100)
            Font = New Font(Font.FontFamily, 20)
        End Sub

        'Notice in our properties, in the set routine we call 'Invalidate()' this will cause the
        'control to redraw anytime the values are changed.

        Private _Value As Long
        Public Property Value() As Long
            Get
                Return _Value
            End Get
            Set(ByVal v As Long)
                If v > _Maximum Then v = _Maximum
                _Value = v : Invalidate()
            End Set
        End Property

        Private _Maximum As Long = 100
        Public Property Maximum() As Long
            Get
                Return _Maximum
            End Get
            Set(ByVal v As Long)
                If v < 1 Then v = 1
                _Maximum = v : Invalidate()
            End Set
        End Property

        Private _Thickness As Integer = 14
        Public Property Thickness() As Integer
            Get
                Return _Thickness
            End Get
            Set(ByVal v As Integer)
                _Thickness = v : Invalidate()
            End Set
        End Property

        'Handle PaintBackground to prevent flicker
        Protected Overrides Sub OnPaintBackground(ByVal p As PaintEventArgs)
        End Sub

        Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            MyBase.OnPaint(e)

            'Create image buffer
            Using B As New Bitmap(Width, Height)
                Using G = Graphics.FromImage(B)
                    'Enable anti-aliasing to prevent rough edges
                    G.SmoothingMode = 2

                    'Fill background color
                    G.Clear(BackColor)

                    'Draw progress background
                    Using T As New LinearGradientBrush(ClientRectangle, Color.Blue, Color.DarkBlue, LinearGradientMode.Vertical)
                        Using P As New Pen(T, Thickness)
                            G.DrawArc(P, CInt(Thickness / 2), CInt(Thickness / 2), Width - Thickness - 1, Height - Thickness - 1, 0, 360)
                        End Using
                    End Using

                    'Draw progress
                    Using T As New LinearGradientBrush(ClientRectangle, Color.LightBlue, Color.Blue, LinearGradientMode.Vertical)
                        Using P As New Pen(T, Thickness)
                            P.StartCap = 2 : P.EndCap = 2
                            G.DrawArc(P, CInt(Thickness / 2), CInt(Thickness / 2), Width - Thickness - 1, Height - Thickness - 1, -90, CInt((360 / _Maximum) * _Value))
                        End Using
                    End Using

                    'Draw center
                    Using T As New LinearGradientBrush(ClientRectangle, Color.Blue, Color.LightBlue, LinearGradientMode.Vertical)
                        G.FillEllipse(T, Thickness, Thickness, Width - Thickness * 2 - 1, Height - Thickness * 2 - 1)
                    End Using

                    'Draw progress string
                    Dim S = G.MeasureString(CInt((100 / _Maximum) * _Value), Font)
                    G.DrawString(CInt((100 / _Maximum) * _Value), Font, Brushes.DarkBlue, Width / 2 - S.Width / 2, Height / 2 - S.Height / 2)

                    'Draw outter border
                    G.DrawEllipse(Pens.DarkBlue, 0, 0, Width - 1, Height - 1)

                    'Draw inner border
                    G.DrawEllipse(Pens.DarkBlue, Thickness, Thickness, Width - Thickness * 2 - 1, Height - Thickness * 2 - 1)

                    'Output the buffered image
                    e.Graphics.DrawImage(B.Clone, 0, 0)
                End Using
            End Using

        End Sub

    End Class
13 posts Page 2 of 2
Return to “Full Software”