|
thx a lot, i just never expected that there would be problems when you use different names.
I'll studie the link you send me
|
|
|
|
|
Hi,
I have a Treeview with large no of nodes. I'm trying to capture the entire tree to a bmp. But, I could get only the visible part of the tree (refer: http://www.syncfusion.com/FAQ/WinForms/FAQ_c3c.asp#q870q). How can I capture all the nodes in tree ??
Thanks
|
|
|
|
|
You'd have to capture the entire tree one screenful at a time and then sew the images together. The entire treeview is not drawn off screen somewhere and the the part that is visiable drawn. The section that is visible is drawn on-demand.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You can't do this by taking a screenshot because it will only contain the nodes in the client region. You should instead consider creating a Bitmap large enough to hold all the nodes (you could calculate this using TreeView.ItemHeight times the total number of items). Then recursively enumerate through your TreeNode s and paint them on the Bitmap using a Graphics object you obtained from Graphics.FromImage .
This is really the only way to capture the complete TreeView since, like I said before, a screen capture would only capture the client region (the currently visible region).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I just hope to know is there any fast and easy way to check whether the path or filename contains invalid character?
I found there is one property from "Path.InvalidPathChars" , but it seems that I need to check whether a path contains these characters by myself .
So, any build-in method can do that??
thanks for help..
|
|
|
|
|
if(myFileName.IndexOfAny(Path.InvalidPathChars)>=0)
{
}
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
azusakt wrote:
So, any build-in method can do that??
try
{
}catch(Exception)
{
throw new UserException("user iq dropped below required standard");
}
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi, thanks for your reply.
I just found that the Path.InvalidCharacters contains 15 characters, but there are only 4 characters is invalid.
I want to check if the entered path contains these characters :
\ / : * ? " < > |
Is it the only way is to check by myself??
|
|
|
|
|
Hi
I'm trying to programmatically execute an interactive CLI program, that is one that not only spits out text to stdout, but also requires input from stdin from time to time. The program I'm trying to launch is the Cisco VPN client, but since I've not gotten anywhere with it and I can't post the client here for license reasons (plus it wouldn't help anyway) I've written a small interactive cli program that I'm using as a test vehicle. Here it is:
static void Main(string[] args)
{
Console.Write("Login[]");
Console.ReadLine();
Console.Write("\r\nPassword[]:");
Console.ReadLine();
Console.Write("\r\nDo you wish to continue? y/n");
string answer = Console.ReadLine();
if (answer.Equals("y"))
Console.WriteLine("yippie");
else
Console.WriteLine("aborting");
}
And I'm launching this test program as follows:
static void main(string[] args)
{
ProcessStartInfo psi = new ProcessStartInfo("c:\\temp\\inputreader.exe");
psi.RedirectStandardOutput=true;
psi.RedirectStandardInput=true;
psi.UseShellExecute=false;
psi.CreateNoWindow=true;
Process proc = Process.Start(psi);
StreamReader reader = proc.StandardOutput;
string line = "";
while ((line = reader.ReadLine())!=null)
{
if (line.Equals("Login[]"))
{
proc.StandardInput.WriteLine("login");
}
if (line.Equals("Password[]:"))
{
proc.StandardInput.WriteLine("password");
}
if (line.Equals("Do you wish to continue? y/n"))
{
proc.StandardInput.WriteLine("y");
}
}
}
Now, if my test vehicle did not require any input from stdin, the above could would work. However, as it waits for some input from stdin, the while ((line = reader.ReadLine())!=null) line sends the controlling program in an infinite waiting loop. If I don't redirect stdout and don't set createNoWindow to true, I can see that my test vehicle is waiting for input that never comes.
Does anybody know what I have to change to make this work?
Regards
Stephan
|
|
|
|
|
i am currently learning c#.net and am able to add items in a listbox via a control button. however, i have not been able to delete a specific listbox item using another control button (i.e. delete). can anyone give me a suggestion? thanks.
Sincerely,
Jason C. Ranin
Software Quality Assurance
|
|
|
|
|
In a Listbox , all items are stored in a 'collection'. You can access this collection using myListbox.Items . Use an indexer (e.g. a number which specifies which items you want) to select a specific item to manipulate. For example, myListBox.Items[0] returns the first item, myListBox.Items[1] the second, and myListBox.Items[myListBox.Items.Count - 1] the last item.
You can use the myListBox.Items.Remove() and myListBox.Items.RemoveAt() methods to remove an item. Look in the documentation of the ListBox for further info.
- Daniël Pelsmaeker
As I said before: I never repeat myself!
|
|
|
|
|
This is an example where a listbox item is selected:
private void btnDelSelectedItem_Click(object sender, System.EventArgs e)
{
if(this.TheListBox.SelectedItem != null)
{
for(int i = 0; i < this.TheListBox.Items.Count; i++)
{
if(TheListBox.SelectedItem.Equals(TheListBox.Items[i]))
{
TheListBox.Items.RemoveAt(i);
i = TheListBox.Items.Count;
}
}
}
}
This is probably not the simplest way to do it, but it works.
I've used this in my code, because I needed to check what kinde of item it was that should be delited, and then make "somrthing happen" depending on the item and the items serounding it.
Hope it helps
Thomas
|
|
|
|
|
Thanks a million. however, there is one problem that i forgot to ask in conjunction with this previous issue. i have actually written each listbox items in a text file. the other part to deleting them from the listbox is to delete them from the text file also. would u happen to know how to approach this since I can't seem to fing the right way. thanks.
Sincerely,
Jason C. Ranin
Software Quality Assurance
|
|
|
|
|
It depends how you save the data, if it is a XML document, I've heard that there is som methods that alow you to modefie singel lines in the file.
The easy way, if there aren't to many items in the List, is to resave all the file.
Hope it helps
Thomas
|
|
|
|
|
Well, it would be quite easy to remove the item using listBox1.Items.Remove(listBox1.SelectedItem) or something similar I believe. And after you have done that, why not just call a method that will rewrite your text file with the current listbox items..That would be the simplest approach in my opinion.
|
|
|
|
|
I have a web page which stores some gif images. I want to be able to read those images from my web application and display them in a picturebox. So far, I'm not making any headway with the Image class. (Apparently the FromFile Method doesn't accepts URI) . Does anyone know which BCL class to use to get those images?
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
hi,
you can try this out...
System.IO.Stream uriStream = System.Net.HttpWebRequest.Create(new Uri("[The request URI]")).GetRequestStream();
Bitmap bmp = Bitmap.FromStream(uriStream);
PictureBox pbDemo = new PictureBox();
pbDemo.Image = bmp;
Hope this works... actually I couldn't run this but it should work... sorry for not giving full proven code...
regards,
Aryadip
Cheers !! and have a Funky day !!
|
|
|
|
|
That's allright... I just neede the pointer. Thanks again.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
Actually, use Page.MapPath or Server.MapPath (Server is an instance of HttpServerUtility provided on several objects in ASP.NET). This maps the virtual path to a physical path that you can use with Image.FromFile .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Cool. Thanks for the tip.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
Actually, I misunderstood your post so ignore what I said. That method is handy when you need to get the physical path of a file based on its virtual path in ASP.NET. My bad.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Help me!
How can create series number in setup InstallShield ?.
Thank !
|
|
|
|
|
As I told you the first time - this question has nothing to do with C# and doesn't belong in this forum. For one, creating a serial number for your installer is completely up to your implementation. If you want help, you should go to http://www.installshield.com[^] and look for answers or help (like a newsgroup) there.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I made this program that has a notify icon, and when you exit the program, i have it just minimize the program to the notify icon instead of actually shutting the program down. The only problem is that when you try to shut off your computer, and the program is still running, your computer doesn't shut down. Any suggestions?
By BigBlob202
Dinco Inc.
|
|
|
|
|
use ExitWindowsEx APi to shut down
Sreejith S S Nair
|
|
|
|