aferia
asked on
How can I add a variable to a 3rd party class?
I am using Dundas chart class. It is in a DLL so I dont have direct access to it. Everything works great, but there is a situation that I am having a hard time going around:
I am handling the mouse click event for several charts in my program. All events are handled by the same function, which in turn calls another function that takes an enum type as a parameter.
Right now I am using an If/Else block that uses the chart titles to define what is the enum that that each chart should be assigned to.
Ideally I would like to use some kind of inheritance to be able to identify each chart directly by an enum that is defined as a member variable.
I am handling the mouse click event for several charts in my program. All events are handled by the same function, which in turn calls another function that takes an enum type as a parameter.
Right now I am using an If/Else block that uses the chart titles to define what is the enum that that each chart should be assigned to.
Ideally I would like to use some kind of inheritance to be able to identify each chart directly by an enum that is defined as a member variable.
Private Sub Charts_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Chart1.MouseClick, Chart2.MouseClick, Chart3.MouseClick
' Call Hit Test Method
Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)
If result.ChartElementType = ChartElementType.DataPoint Then
Dim frmTest As New DrillDownWindow
'This is what I would like to do, but I cant beacause enumChartType is not a defined memeber in Dundas Chart class
frmTest.GenerateData(sender.enumChartType)
frmTest.Show()
frmTest.BringToFront()
End If
ASKER
The problem with inheriting the control is that I loose the advatage of being able to setup the chart using the form designer. Dundas charts can be manipulated from the form designer and they have a very good wizard that can only be accessed from the form designer.
I dont what .tag is, can u expand a little?
I dont what .tag is, can u expand a little?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great! That was exactly what I needed... it worked like a charm!
Thank you very much!
Thank you very much!
If you want something more type safe, then inherit the control and add whatever fields you want to it.