|
hi,
i need to take a visio file and convert it to .pdf in a C# project. anyone could help?
|
|
|
|
|
There's lots of commercial libaries and some free ones, but I don't know how many work with Visio. You can use a PDF print driver to turn any file into PDF, tho
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi people!
I have been trying for days to populate a treeview from a particular structure.
The text file i have to work with is similar to this:
root
root/folder1
root/folder2
root/folder2/subfolder1
root/folder2/subfolder2/subfolder3
root/folder3/subfolder4
root/folder4
Which I can almost get to populate a treeview with. In fact, i can get to root/folder2/subfolder2/subfolder3, and then it wont display the root/folder3/subfolder4 because it hasnt created the root/folder3 path first!
There must be an easier way to do this!!!
Here's my '2 evenings of working on this now', code so far:
ArrayList paths = {the file split line by line into an arraylist}
private void Run()
{
treeView1.Nodes.Add("root");
Buildtree("root", treeView1.Nodes[0]);
}
private void Buildtree(String path, TreeNode parentNode)
{
ArrayList directories = GetDirectories(path);
if (directories.Count != 0)
{
foreach (string directory in directories)
{
TreeNode node = new TreeNode(directory.Remove(0, path.Length + 1));
parentNode.Nodes.Add(node);
Buildtree(directory, node);
}
}
}
private ArrayList GetDirectories(string parentPath)
{
ArrayList directories = new ArrayList();
foreach (string path in paths)
{
if (path.StartsWith(parentPath))
{
bool hasSubdir = false;
if (path.Contains('/') && (path.Length > parentPath.Length))
{
int startpos = parentPath.Length + 1;
string leftover = path.Substring(startpos, path.Length - startpos);
if (!string.IsNullOrEmpty(leftover) && leftover.Contains('/')) hasSubdir = true;
}
if (!hasSubdir && (path != parentPath))
directories.Add(path);
}
}
return directories;
}
Im going bonkers over this!!
|
|
|
|
|
0) Why are you using ArrayList instead of List?
1) That should be easy.
1.0) Use String.Split to split the string on '//'
1.1) Enumerate the resultant strings creating Nodes as necessary
|
|
|
|
|
Hi,
I just finished this little article[^] which may interest you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Woo Hoo!! Luc, Thank you VERY much! You're amazing!
And thank you to all the others (one person) who came back with a slightly subdued answer.
Now to try the code myself...
|
|
|
|
|
Hi,
I just updated the little article[^] as I realized recursion wasn't really needed, a simple loop is sufficient.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Much better, smaller, cleaner, just the way I like it! Many thanks, Luc
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hallo
I wrote a small system tray application, and I would like to make it react to shortcuts.
How could I achieve this?
thanks in advance
|
|
|
|
|
I do not think that you can do that without hooking keyboard events globally.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thank you Henry, I was actually looking in that direction...
|
|
|
|
|
|
Hi!
im new to encryption and would appreciatelittle help
currently im using CryptoStream(RijandelManaged) with NetworkStream and it seems to work except that i dont get all the data right away.
this is my current code:
RijndaelManaged r = new RijndaelManaged();
cryptoReadStream = new CryptoStream(netStream, r.CreateDecryptor(key, iv), CryptoStreamMode.Read);
byte[] buffer= new byte[10000];
cryptoReadStream.Read(buffer,0, buffer.Length);
the problem is:
1.cryptoStream.Read blocks until 10000 bytes have been recived, unlike NetworkStream.Read which returns when theres is nothing more to read,
this is a problem beacuse if the server only writes 10 bytes then ill have to wait forever before i can diplay the results.
|
|
|
|
|
You can read it to an intermediate MemoryStream, still cryptografed, and after finishing reading you use the cryptoStream to decrypt the data.
Regards,
Leonardo Muzzi
|
|
|
|
|
Hi
I need to send file (text file) to com1 (RS-232) port, how i can do it ?
thank's in advance
|
|
|
|
|
SerialPort serialPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
serialPort.Open();
serialPort.Write(File.ReadAllText(@"file.txt"));
serialPort.Close();
|
|
|
|
|
|
|
I need a pointer to a good article on delegates/events in client/server apps.
Specifically I need the server side to raise an event that all logged on clients can receive and react to.
The server does not need to know if any clients received it.
Searching available resources just gives too many results.
|
|
|
|
|
|
|
Did you handle the FORM's KeyDown event, or one of the buttons??
|
|
|
|
|
Yeah, the following code :
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Down)
{
MessageBox.Show("Pressed");
}
}
|
|
|
|
|
That code snippet will deal with the down-arrow key of your keyboard, and is unrelated to the four buttons your picture is showing, one of which displays "Down" as its Text.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|