|
|
|
I failed to mention that you need to specify that the WinForm object is going to be used for the scripting from JavaScript. The following property should be updated from your WinForm class:
webBrowser1.ObjectForScripting = this; Sorry for this oversight.
|
|
|
|
|
hey all,
i am new to c#
what am i trying to do is
make a panel in form1 and free hand draw on that and it should automatically display on the panel in form2.
can i do that?
and can anyone post some examples i can use?
please thanks a lot
|
|
|
|
|
You should capture the drawing elements and their parameters into some data structures, and paint the drawing from that data; if you want to see more than one instance, just paint as many as you like.
This article[^] could offer some useful guide lines.
|
|
|
|
|
thanks for the reply
i mean do you have any examples that i can work with
i am really really new to c#
|
|
|
|
|
Then go to a book store, look at a range of C# books, choose one or two that look interesting to you, buy them, and study them. Once you got the fundamentals, start reading some articles, a lot of good stuff can be found on this very site. Programming is work, it isn't finger painting.
|
|
|
|
|
Luc Pattyn wrote: Programming is work, it isn't finger painting. Killer sig material.
/ravi
|
|
|
|
|
0down votefavorite
I have a collection of NodeModel objects:
public class NodeModel : ViewModelBase
{
public Guid Id { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public NodeType Type { get; set; }
public List<NodeModel> Children { get; set; }
}
I need to provide Move Up and Move Down functions. To move an item up in the collection, it seems like I would need to know the the item's parent.
True is, I'm not really sure how to implement this. Anyone done this? Can you point me in the right direction?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
|
Mark, I don't think a linked list is a good basis for a model of a hierarchy.
best, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
Your objects seems akin to Controls on a WinForm, so why not use their model? Each Control has a ControlCollection holding its children, and a Parent property pointing to its parent (null for any topmost Control).
When in doubt, look for similar situations and reuse existing concepts.
|
|
|
|
|
|
Yes, I'm using WPF and ObservableCollections. The question then is, in a hierchical collection, how do you know a node's index position? Seems like I'll need to recurse.
If it's not broken, fix it until it is
|
|
|
|
|
See my comments a couple of threads down. You need to be crystal clear about what your hierarchy (and the internal relationships - parent/child/sibling/etc) represent, so you can clearly define your add/delete/move/whatever operations.
Yes, given that a hierarchical structure is involved, you will be up for recursion (or possibly an equivalent iteration). For a many-children "tree", search the big G or Wikip for "trie". That might just hand it to you on a platter.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Give a node a reference to its parent? That's what I've done in every tree-like data structure I've ever built.
|
|
|
|
|
Sounds like a good idea. Do you worry at all about dangling references?
If it's not broken, fix it until it is
|
|
|
|
|
No. .Net's garbage collector will clean up for me. If I remove a child, the fact that it still references its parent is irrelevant, as the child will be collected, and then it's no longer sitting on a reference.
|
|
|
|
|
Kevin Marois wrote: I need to provide Move Up and Move Down functions. I think Bob Janova's suggestion that you include in your Node-whatever base class a 'Parent field is the correct solution, and it will have so much additional functionality, in the long run, it's the "only" solution.
What you leave unspecified in your question are the interesting cases such as:
You wish to move up a child Node of a Parent Node:
a. assuming the Parent Node has other siblings prior to the the Node to be "promoted:" the "promoted node" then remains a sibling of the Parent node, but now precedes the prior sibling in the collection ?
b. assuming the node to be "promoted" is the first child of its Parent Node: the "promoted node" then becomes a sibling of its former Parent node, preceding its former Parent node in the collection ?
I think you can also easily see that you will need to think through other "edge cases" involving moving a Node "down" in the collection/tree.
Also consider that some tree data structures (in computer science algorithmic theory) are based on having a single root node from which all other Nodes descend, and other trees, as you see in the typical TreeView Control in .NET, are based on having an arbitrary collection in which any number of Nodes can be root-level.
Since you use the word "collection" here, I would assume you are allowing multiple root-nodes. In that case the top root-node cannot be moved up, and the last root-node cannot be moved down.
imho it's a useful convention to make the design choice that if the 'Parent field of a Node, in a collection-based tree, contains 'null, then the given Node is a "root-level" node.
Now if you are constructing your own "hierarchic visual display" of this collection/tree structure ... not using some existing TreeView control ... then ... welcome to recursion.
best, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
Hi All,
What it is i would like to do is add a new item into an existing sharepoint list. The fields in this item will be filled out using variables existing in my program.
I've had a look around the internet and its not making much sense so i was hoping one of you guys could shed some light on me?
Many thanks in advance! 
|
|
|
|
|
This really should have been posted in the SharePoint forum. But since the damage is already done...
First, what version of SharePoint, WSS 3, MOSS 2007, 2010 Foundation?
Second, how are you accessing SharePoint? WebServices, server application, service, Client Object Model?
If you give more details about what you are doing you will get a better answer.
Failure is not an option; it's the default selection.
|
|
|
|
|
Hello,
I have one web based application using vb.net codebehing. Now i have to convert this into C#.net. Can anyone help me how to convert whole vb.net web application into C#.net web application. My application has 110 pages so its not possible to convert one by one page. Is it possible to convert whole application ?
Thanks & Regards
Do hard work, you will get your result sure !
|
|
|
|
|
You can use one of the conversion tools[^] to get the code converted, followed by a few sessions of build and test.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
|
I have a collection of NodeObject classes in a hierarchical list. The list can be any number of levels deep.
public class NodeModel : ViewModelBase
{
public Guid Id { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public NodeType Type { get; set; }
public List<NodeModel> Children { get; set; }
}
How can I remove an item from the list using its Guid Id regardless of where it is in the list?
If it's not broken, fix it until it is
|
|
|
|