|
It's easy with the right approach: Position the leaves first.
If each leaf has its own space in the Y dimension (i.e. no other nodes under it), you can easily assign Y coordinates for all the leaves. Just go through them from left to right, incrementing the Y coordinate according to each leaf's width and the gap between adjacent leaves.
The X coordinates come from the leaves' depths.
The next step is to assign coordinates to the interior nodes. One approach is to position each interior node in the middle above its leaves.
Finally go through all the nodes, drawing them at their assigned coordinates, and drawing links from each interior node to its children.
|
|
|
|
|
I encounter this particular problem. I am currently using visual studio 2010, aforge subtract class. when i try to run the program, nothing happened. the code as below:
private void button5_Click(object sender, EventArgs e)
{
Bitmap overlayImage = new Bitmap(pictureBox3.Image);
Bitmap sourceImage = new Bitmap(pictureBox4.Image);
Subtract filter = new Subtract(overlayImage);
Bitmap resultImage = filter.Apply(sourceImage);
pictureBox5.Image = pictureBox5.Image;
}
Where have i gone wrong?
ref: http://www.aforgenet.com/framework/docs/html/2d04f587-3272-2ad5-f8bc-54ff407d41f2.htm[^]
|
|
|
|
|
Uhhh...pictureBox5.Image = pictureBox5.Image; You really don't think there's a problem with this?
Aren't you completely ignoring the resultImage and not doing anything with it?
Seems pretty obvious to me...
|
|
|
|
|
sorry there is a typo. after i changed, it still cant work.
|
|
|
|
|
But what did you change it to? We can't help if you don't provide that as well.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
i changed it to this:
private void button5_Click(object sender, EventArgs e)
{
Bitmap overlayImage = new Bitmap(pictureBox3.Image);
Bitmap sourceImage = new Bitmap(pictureBox4.Image);
Subtract filter = new Subtract(overlayImage);
Bitmap resultImage = filter.Apply(sourceImage);
pictureBox5.Image = resultImage;
}
|
|
|
|
|
There are a couple of things to consider here.
1) You aren't wrapping your bitmaps (disposable objects) with the using statement so they will leak like buggery.
2) You were told yesterday that questions about a third party library should be directed to the appropriate supplier.
|
|
|
|
|
pancakeleh wrote: Where have i gone wrong?
Are the pictures of the same size and pixelformat?
I are Troll
|
|
|
|
|
Hi,
I'm looking for an example of how to read xmls and count the number of times a specific element appears in it. I haven't had much luck, but have been looking for the past 3 hours for examples on the web as to how to do this. I'm a little confused as to the .SelectSingleNode syntax as well. If anyone has a class or method that I can point to an xml, search for a string and output the results, I'll be able to play with it and tweak it and teach myself how this works.
Thanks!
|
|
|
|
|
Is the element always at the same level? You are looking for multiple nodes so SelectSingleNode isn't what you want. You probably want SelectNodes and then get the Count of the returned XmlNodeList. Without knowing your schema I can't give you the exact XPath to use. I do not recommend a flat string search.
|
|
|
|
|
I believe they are on the same level
There is a root element, and the element I am searching for is always at the next level right under the root level element. I could do a string search, as the element is unique with the <>, but if that is a poor way of doing it, I would rather do it the right way.
|
|
|
|
|
Why are you using SelectSingleNode? Why aren't you using SelectNodes to retrieve all the matching nodes? Why not use XLinq?
|
|
|
|
|
Hi,
I tried this and it didn't work? I wasn't sure where to initialize the xml doc name though?
XmlDocument xmlDoc = new XmlDocument();
documentElements = xmlDoc.SelectNodes("Document").Count;
Console.WriteLine(documentElements);
Console.ReadLine();
|
|
|
|
|
First things first, I'd use /Document to iterate over the child nodes of the root element looking for Document. If the node name has a namespace, you'll need to reference that namespace in there.
|
|
|
|
|
Hi,
If this is what you meant, it comes back with a value of 0
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"c:\temp\testzip\test.xml");
documentElements = xmlDoc.SelectNodes("t").Count;
Console.WriteLine(documentElements);
Console.ReadLine();
I even set the string to just "t" and that still returns a 0? So I must be doing something wrong.
|
|
|
|
|
Unless you have an XML element called t that is exactly what should happen. SelectNodes takes an XPath expression as an argument. It isn't a string search. If you are looking for Document elements you need to search for /Document. The / tells it to search from the document root. Otherwise it will search from whatever point you are at in the file at the time.
If you are going to use XML as your data format you should really make an effort to learn XPath. XPath tutorial[^]
|
|
|
|
|
Hi,
Thanks for the link
It looks like I have to have
documentElements = xmlDoc.SelectNodes("//Document").Count;
to get it to work, so it starts at the root only if there are 2 slashes? I got that from the link you sent me so thanks
|
|
|
|
|
hello every one!
when i use this
SendKeys.Send("{PRTSC}");
it only capture the form or small image of it
what is the problem?!
EASY COME EASY GO
|
|
|
|
|
|
thanks but i have some programs that i made it did not capture so what do you suggest?
EASY COME EASY GO
|
|
|
|
|
sanforjackass wrote: thanks but i have some programs that i made it did not capture so what do you suggest?
How did you try capturing the screen in those programs? The same method as described in your original post?
Anyway, if you haven't read the article I recommended, I suggest you do that - I'm almost sure it will help you.
|
|
|
|
|
OK i will let you try it
but first i should send you my program run it then try to capture with your program.
does it work?
(what is your email)
EASY COME EASY GO
|
|
|
|
|
Seriously you don't expect him to sit down en debug your program? Suggesting that is quite rude if you ask me.
Do this the right way: provide the code snippet that doesn't work and let people here have a look at it.
|
|
|
|
|
dont be a smart
if you think you can solve it send me your email then i send you my program then try it,
it works good the problem is when i use the other program to get image of the desktop it does not show my program. why
EASY COME EASY GO
|
|
|
|
|
I don't want you to send me your program and really doubt anyone else in here want that either. You can't expect people to do that kind of work for you - and I still believe asking for it is rude and should be avoided. My guess is people will be less interested in helping you if you use that approach.
|
|
|
|