Click here to Skip to main content
15,886,689 members
Articles / Programming Languages / Visual Basic

Mathemathics Framework

Rate me:
Please Sign up or sign in to vote.
4.76/5 (56 votes)
16 Sep 2008CPOL6 min read 75.3K   6.2K   171  
.NET Mathematical Framework
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
'Imports System.Windows.Forms.cmp


<CLSCompliant(True)> _
Public Class BVToolBarBandCollection
    Inherits BVToolBarCollectionBase


    Public Event ButtonClick(ByVal sender As Object, ByVal e As BVToolBarButtonClickEventArgs)
    Public Event ButtonDropDown(ByVal sender As Object, ByVal e As BVToolBarButtonClickEventArgs)


    Public Sub New(ByVal owner As BVToolBar)
        MyBase.New(owner)
    End Sub

    Default Public Shadows Property Item(ByVal index As Integer) As BVToolBarBand
        Get
            Return MyBase.Item(index)
        End Get
        Set(ByVal Value As BVToolBarBand)
            If Not MyBase.Item(index) Is Value Then
                If Not MyBase.Item(index) Is Nothing Then
                    RemoveHandler CType(MyBase.Item(index), BVToolBarBand).Change, AddressOf OnChange
                    RemoveHandler CType(MyBase.Item(index), BVToolBarBand).VisibilityChange, AddressOf OnChange
                    RemoveHandler CType(MyBase.Item(index), BVToolBarBand).ButtonClick, AddressOf OnButtonClick
                End If
                MyBase.Item(index) = Value
                MyBase.OnChange(Me, New EventArgs)
                AddHandler Value.Change, AddressOf OnChange
                AddHandler Value.VisibilityChange, AddressOf OnChange
                AddHandler Value.ButtonClick, AddressOf OnButtonClick
            End If
        End Set
    End Property

    Default Public Shadows ReadOnly Property Item(ByVal BndName As String) As BVToolBarBand
        Get
            Dim i As Integer

            For i = 0 To Me.Alist.Count - 1
                If CType(Alist.Item(i), BVToolBarBand).Name = BndName Then
                    Return Alist.Item(i)
                End If
            Next
            Return Nothing
        End Get
    End Property

    Public Shadows Function Add(ByVal band As BVToolBarBand) As Integer
        MyBase.Add(band)
        band.Parent = Me.tlbar
        MyBase.OnChange(Me, New EventArgs)
        AddHandler band.Change, AddressOf OnChange
        AddHandler band.VisibilityChange, AddressOf OnChange
        AddHandler band.ButtonClick, AddressOf OnButtonClick
    End Function

    'Public Overloads Function Add(ByVal Text As String) As Integer
    '    Dim btn As New BVToolBarBand
    '    btn.Text = Text
    '    MyBase.Add(btn)
    'End Function

    Public Shadows Sub Remove(ByVal band As BVToolBarBand)
        MyBase.Remove(band)
        MyBase.OnChange(Me, New EventArgs)
        RemoveHandler band.Change, AddressOf OnChange
        RemoveHandler band.VisibilityChange, AddressOf OnChange
        RemoveHandler band.ButtonClick, AddressOf OnButtonClick
    End Sub

    Public Shadows Sub AddRange(ByVal bands() As BVToolBarBand)
        Dim i As Integer
        MyBase.AddRange(bands)

        For i = 0 To bands.GetUpperBound(0)
            bands(i).Parent = Me.tlbar
            AddHandler bands(i).Change, AddressOf OnChange
            AddHandler bands(i).VisibilityChange, AddressOf OnChange
            AddHandler bands(i).ButtonClick, AddressOf OnButtonClick
        Next
        MyBase.OnChange(Me, New EventArgs)
    End Sub

    'Protected Sub onChange(ByVal sender As Object, ByVal e As EventArgs)
    '    onChange(sender, e)
    'End Sub


    Protected Sub OnButtonClick(ByVal sender As Object, ByVal e As BVToolBarButtonClickEventArgs)
        RaiseEvent ButtonClick(sender, e)
    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Universidad Tecnológica Nacional
Argentina Argentina
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions