Control Question

  • Thread starter Thread starter graeme g
  • Start date Start date
G

graeme g

hi

how would I do the following :

i have a control which has a property which is an array of that control...

i.e. kinda like how a treenode has treenode's as children

but i want to be able to only add controls which are already on the form ...

i'm guessing i would need to write some kinda collectioneditor - but i
don't know how to do this...

can anyone help me???

thanx
g
 
basically i'm trying to develop a scheduling application -

a task can have one or many subtasks - so i want one task component and
be able to attach the subcomponents to it so that it can draw connected
lines between them e.g.

TASK 1 ------- TASK 2 ------- TASK3
|
|
TASK 4 -------TASK 5

or something like that...

Thanks
g
 
What i would do is create a custom control and provide the base control.
Inside the control def create a method that adds another control(task) to the
parent. Something like: add(string title, string desc) then in the def build
the GUI. Let me know if this is what you are looking to do.
 
As far as code goes, I would create/use whatever base class you have as
a "task" -
Let's call it: TaskItem

You will also want a TaskItemCollection class that inherits
System.Collections.CollectionBase.

Within the TaskItem class you can then have a property that is of the
type TaskItemCollection.

basically:

public class TaskItem
{
public TaskItemCollection TaskItems;
// Any other properties, methods, classes, etc...
}

public class TaskItemCollection : System.Collections.CollectionBase
{
// Add code to implement the methods of
System.Collections.CollectionBase
}

As far as the visual connection, perhaps have TaskItem inherit from a
class in System.Drawing, or System.Windows.Forms - then add a method
(.ConnectChildren()) to create the visual connectors.
 
Back
Top