|
Hi there,
I am trying to map the items between two mailboxes by drawing lines between them. Kind of like SSIS. I am looking for the best way to do this. Should I create a line object and use it to draw lines? or should I create a GraphicsPath object so that I can keep the track of lines.
How should I deal with user scrolling up and down the listbox because lines must be refreshed and move along with items attached.
Thanks everybody,
Ryan
|
|
|
|
|
Are the two mailboxes in two seperate listboxes or merged into one?
|
|
|
|
|
No these are separate listboxes.
Ryan
|
|
|
|
|
Hello,
jerrymei wrote: Kind of like SSIS
Ehm.. Pardon me but, what is an SSIS??
jerrymei wrote: Should I create a line object and use it to draw lines? or should I create a GraphicsPath object so that I can keep the track of lines.
I don't think it would make a big difference specially that you will have to refresh your lines may times -when moving the form, resizing, repainting, etc...-
jerrymei wrote: I am trying to map the items between two mailboxes
Is that mailboxes, or listboxes?!!
jerrymei wrote: How should I deal with user scrolling up and down the listbox
Some points arising:
1- When the user scrolls one listbox, will the other auto scroll with the same value?!!
2- When you draw lines, what about the items not visible in the listboxes?? Will you hide their lines as well.
It all depends on your point of view, and how you want this form to appear. There are million ways to make something, but you have to choose one
Regards
|
|
|
|
|
Hi,
SSIS => SQL Server Integration Services
Yeah sorry I meant listboxes.
Well I was thinking to scroll the listboxes independently and in regards to non-visible items no I want to keep the lines visible.
Thanks,
|
|
|
|
|
Hello again
Well, whatever will be in the two listboxes, it's a matter of graphical connection between two controls. So, I got an idea for you.
Make a custom UserControl get its graphics and draw your lines in it. This will insure your lines won't go too far if the listboxes items are too many. Now place this Control exactly between your two listboxes, feed it with the tis inputs:
1- Which item is connected to which item. eg. item1-> item5, item 2->item1, etc...
2- Location of each list box, the index of the first visible item. Using this you can calculate the relative location of all invisible items. eg.
item1.Location = FirstVisibleLocation - DifferenceInIndex * ItemHieght
Now you got two arrays of items locations, and the relations of each item to the other listItems. Draw in the graphics area of the custom control, and only inside it shall the lines appear. When the user scrolls or changes the content of any listox, your control must be refreshed
Your Form should look something like this:
--------- --------- ---------
| || \ /|| |
| List1 || - - -\/-|| List2 |
| || /\ || |
| || / \|| |
--------- --------- ---------
Well... Something... like the above
I hope you get my idea. beware of flickering. This may need additional workup if happens.
Regards
|
|
|
|
|
Thanks Nader,
I think this is a very good idea. I am trying different methods now and I am sure going to give this one a try too.
Will Let you know about the results.
Thanks again for your time.
|
|
|
|
|
You are welcome
|
|
|
|
|
Hi Nader,
I am working on your proposed solution. It seems I am getting somewhere with it.
When I want to draw the lines on the control I use the rectangle of the selected item on each list box for starting and ending points, but I think its giving me a hard time because the controls cordinates system is different than the parent form so let's say point1(120,43) is a completely different point on the user control.
Could you tell me how to map these two together, is there anyway to ask the user control to draw the lines based on the parent form cordinates??
Thanks,
|
|
|
|
|
Hello
There are two methods in the ListBox class inhertited from Control class:
PointToScreen() - Computes the location of the specified client point into screen coordinates
PointToClient() - Computes the location of the specified screen point into client coordinates
I suggest You follow these steps:
1- Use the ListBox.GetItemRectangle() to obtain item's coordinates
2- Transform it to screen location
3- Feed it to your CustomControl
4- Transform it to client location -this time it will be relative to the custom control
5- Draw you lines nice & easy
I hope it works fine for you
Regards
|
|
|
|
|
Well actually these two methods didn't work for me, I don't perhaps I couldn't implement it properly, but what I did I used TranslateTransform method to transform my coordinates to the upper left corner of my user control and it works properly now.
Thanks again dude,
|
|
|
|
|
I have one question how to make online chater in C# ???
thanks!!
nemanja
|
|
|
|
|
|
conemajstor wrote: I have one question how to make online chater in C# ???
That's like saying "I have one question...How does the US economy work?"
Ask specific questions if you want to get practical answers.
:josh:
My WPF Blog[^]
|
|
|
|
|
|
I'm trying to extend the bitmap or image classes. I've determined that the image class can only be extended by a member of it's own assembly. Now im struggling with the bitmap class being non inheritable. Does any one have any clever ideas about extending either of these two classes. Thanks
|
|
|
|
|
|
no it's not seald. But the Image class can only be extended by another member of the system.drawing assembly. grrr
|
|
|
|
|
|
I'd like to create a bitmap/image object that can scale and encode itself with internal methods.
|
|
|
|
|
You can't derive from Image because it lacks public Constructors. Only classes inside the same assembly can inherit from it.
The Bitmap class is tagged sealed , or NotInheritable (VB.NET), so you can't inherit from that either.
You'll have to construct your own class from scratch, or find a 3rd party library that does what you want.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You could wrap it:
class MyBmp {
private Bitmap bmp = null;
public MyBitmap(...)
{
bmp = new Bitmap(...);
}
public Method1(...) {}
public Method2(...) {}
}
You need to rewrite all methods and constructors you want/need and internally operate on your Bitmap object. It's a bit of work, but it should do the job.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thats great advice. I'll try that and let you know how it turned out
|
|
|
|
|
hi,
i have a property grid control... can u plz guide me how to display a set of values in a drop down form in the property grid control. i am using c# windows application.
-- modified at 12:04 Monday 3rd July, 2006
|
|
|
|
|
TypeConverter.GetSupportedProperties()
|
|
|
|