|
You really need an internal representation of your drawing.
You should build it up with mouse and/or keyboard events
and paint it in the OnPaint handler.
You then can also add file open and file save operations.
OnPaint is called automatically whenever there is a good reason to repaint the form or panel,
such as:
- form/panel became visible again (an overlapping form has been moved or closed)
- form gets resized (including form maximize, restore from minimize, restore from maximize)
- probably many more
- or you explicitly causing a repaint by calling Invalidate(), e.g. after you loaded a new file.
Luc Pattyn
|
|
|
|
|
Call Invalidate and pass it the region to be redrawn whenever you cause an event that needs to be drawn.
File Not Found
|
|
|
|
|
How in C# when I try to write over a file which another user has open do I find out their username so I can show it in a MessageBox?
TIA.
|
|
|
|
|
You have 2 people editing a file at the same time?
|
|
|
|
|
No, the application creates a PDF file - occasionally somebody might want to recreate the PDF file and even more occasionally somebody might already have the PDF file open - the chances of it happening are slim but if it does happen I would like to be able to display the username of the user who has the file open.
|
|
|
|
|
Why not just have a policy where users save the PDF to their local machine before opening? If they are viewing it via the web, send it via a stream, instead of the actual file.
|
|
|
|
|
What is the simpliest way to make a direct system call in managed C# (i.e. equivalent to system() function in C)?
I'm unable to find it on the internet..
|
|
|
|
|
If you'd like to call a function in the external library, you should look at DllImportAttribute and P/Invoke mechanism in .NET.
Wizard_01
|
|
|
|
|
No, I'd like to execute a shell command, for example 'chkdsk' or 'rm' or 'dir' (whatever). In the old ANSI C this was done by calling system(string) function from stdlib. I can't find a corresponding solution in .NET. If I have to, I will use P/Invoke to call system(...), but I don't know what library I have to import either (I don't think it is stdlib.dll..?).
|
|
|
|
|
I believe you want the System.Diagnostics.Process class.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Have a look at the Process class.
For simple commands a simple Process.Start(string) will do.
Luc Pattyn
|
|
|
|
|
Thanks a lot folks!
That was exactly what I was looking for.
|
|
|
|
|
Hi,
I have a user control in a window form. In user control i have a button.
On click over this button i want to change the window form label text.
How i can do it ?
I am new to c#. please help
|
|
|
|
|
delegates and events .
It's too difficult to explain in short text, but you can look up examples on google or MSDN.
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
I think the simplest way is:
1- add a usercontrol to your project
2- add a button, named in Button1 to your usercontrol, set Button1 "Modifiers" property to Public.
3- build your project.
4- after adding your user control, named in UserControl1 to your form, add this lines of code:
-------------------
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler UserControl1.Button1.Click, AddressOf Button_Click
End Sub
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'do your task here
End Sub
-------------------
5- what you wanted is done
|
|
|
|
|
Unknown C# dialect.
Luc Pattyn
|
|
|
|
|
add these line of code to your form:
private void Button_Click(object sender, System.EventArgs e)
{
// do your task here
}
then in your form load event add:
UserControl1.Button1.Click += new System.EventHandler(this.Button_Click);
|
|
|
|
|
Sure.
I think I understood the first time.
My remark was it did not really look like C#, the subject of this message board.
Luc Pattyn
|
|
|
|
|
Hello,
Here some code for the suggestions from "V".
UserControl code:
public event EventHandler ButtonClickChanged;
protected virtual void OnButtonClickChanged(System.EventArgs e)
{
if (ButtonClickChanged != null)
{
ButtonClickChanged(this, e);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
OnButtonClickChanged(System.EventArgs.Empty);
}
Forms code:
public Form1()
{
InitializeComponent();
userControl11.ButtonClickChanged+=new EventHandler(userControl11_ButtonClickChanged);
}
private void userControl11_ButtonClickChanged(object sender, EventArgs e)
{
}
Hope that helps!
All the best,
Martin
|
|
|
|
|
I just tried to generate some XML documentation for my project. The output is great as far as it goes but it's not very readable. Is there a tool like JavaDoc or doxygen available for .NET?
I tried to look into nDoc but the last reference to anything on their site was from 2004.
TIA
Russell
|
|
|
|
|
The NDoc project has stopped further development. The last official version supports .NET 1.1 only, but there are unofficial hacks that support .NET 2 roughly.
MS has Sandcastle in beta.
Sandcastle[^]
I don't know when it's due for release. Apart from that there are one or two commercial tools around. But I assume you are after free or open source?
|
|
|
|
|
for the immediate future it needs to be free or open source as getting money out of the bean counters seems almost impossible at the moment. It's a shame that a community project like NDoc has halted. I'll be taking a look at Sandcastle this evening.
Thanks
Russell
|
|
|
|
|
Take a look at this article here on CP: Sandcastle Help File Builder[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
thanks,
i'll be taking a look this evening
Russell
|
|
|
|
|
Hi there!
I wrote an application which is used over network on a fileserver. It's lying there and every user starts it from that share. To do that I found out that I have to change the CodeGroups in the .NET-Configuration of the client-machine. I'm using the Strongname for my application and its DLLs. That works fine but there are so many clients which have to use my application. Is there any way to simplify that? I know I could use those Deployment Packages but I'm afraid to modify some other existing CodeGroups of some client machines. So I need to know
a) if there's any way and how it works to make a Deployment Package of just my CodeGroup and not every existing CodeGroup
or
b) if there's any way and how it works to solve this problem from server side. Maybe setting a CodeGroup from there so the clients don't need to do anything or something like that.
Thanks for reading even if you can't help me.
-- modified at 12:16 Tuesday 6th February, 2007
|
|
|
|