Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adding an inherited Box to an inherited FlowChart? (Read 2320 times)
ChrisBrowne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Location: Hants, England
Joined: Jan 11th, 2007
Adding an inherited Box to an inherited FlowChart?
Jan 11th, 2007 at 12:13pm
Print Post  
Hi there Mind Fusion!

We're using your FlowChartX controls for the front end of our new application, and we wish to add some custom functionality to the FlowChartX.Box class to make it change its Me.Pen color with certain state changes in our app.

I've created a new class inheriting from your FlowChart class and overridden the CreateBox to add my inherited Box class which I've extended with functionality to change its .Pen.Color when the state changes.

However when I execute the CreateBox method, the box isn't shown on the FlowChart. I'm not too sure what to do. Here is my code...

Code
Select All
Public Class Chart
    Inherits MindFusion.FlowChartX.FlowChart

    Public Overloads Function CreateBox(ByVal x As Single, _
						    ByVal y As Single, _
						    ByVal width As Single, _
						    ByVal height As Single) As ActionBox
	  Dim newActionBox As ActionBox = New ActionBox(Me)
	  newActionBox.Move(x, y)
	  newActionBox.Resize(width, height)
	  MyBase.Boxes.Add(newActionBox)
	  Return newActionBox
    End Function
End Class

Public Class ActionBox
    Inherits MindFusion.FlowChartX.Box

    Private _action As Action = Nothing

    Public Sub New(ByVal flowChart As MindFusion.FlowChartX.FlowChart)
	  MyBase.New(flowChart)
    End Sub

    Public Property Action() As Action
	  Get
		Return _action
	  End Get
	  Set(ByVal value As Action)
		_action = value
		AddHandler _action.Highlight, AddressOf _action_Highlight
		AddHandler _action.UnHighlight, AddressOf _action_UnHighlight
	  End Set
    End Property

    Private Sub _action_Highlight(ByVal sender As Object, ByVal e As EventArgs)
	  Me.Pen.Color = Drawing.Color.Yellow
    End Sub

    Private Sub _action_UnHighlight(ByVal sender As Object, ByVal e As EventArgs)
	  Me.Pen.Color = Drawing.Color.Black
    End Sub
End Class
 



Can you help?

Cheers,
Chris
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adding an inherited Box to an inherited FlowCh
Reply #1 - Jan 11th, 2007 at 12:49pm
Print Post  
Hi Chris!

The control draws all items that are in the ChartObjects collection, so you will need to add the box there too. Or better call

MyBase.Add(newActionBox)

instead of

MyBase.Boxes.Add(newActionBox)

The FlowChart.Add method adds the box to both the Boxes and ChartObjects collections and creates an undo/redo record for the operation.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ChrisBrowne
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Location: Hants, England
Joined: Jan 11th, 2007
Re: Adding an inherited Box to an inherited FlowCh
Reply #2 - Jan 11th, 2007 at 1:09pm
Print Post  
That's brilliant!

Thanks Stoyan  Grin
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint