|
Hi,
Thanks!!! It works perfect, but I still can’t understand how it worked with the BMP-encoding and not with Gif. Sometimes we must just accept the strange thinks in life
/ Magnus
|
|
|
|
|
Hello,
Can anyone tell me how to prevent my program being killed by pressing "End Task" of task manager ? I have seen that when we try to kill some apps it tells that we cannot terminate it, because of "some" reason.
Thanks James
|
|
|
|
|
Basically, you can't prevent this.
There are various reasons for not being able to kill the process, like the process is running under a priviledged or system account, is a system service where Windows cannot work without it, there is a debugger attached to the process, ...
But in all these cases, you're application would not be running under these circumstances. I've "heard" of a couple people doing this, but noone has ever come up with any code examples demonstrating it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If you want to do this for a security program of some sort, you can have the program called under the user Administrator, and leave the computer on with a user account that doesn't have administrative rights.
Another way, depending on what you're trying to do, might be to start the program as a Windows service, and again, use a user account that doesn't have access to the Services control panel.
|
|
|
|
|
Why are you telling me this? I didn't post the question.
Also, I can't quite understand what your saying in the first paragraph, but it doesn't sound like a good idea. You NEVER use the Administrators account for anything other than system administration. Applications/Services/Servers should NEVER use this account.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oops, sorry. Does a notification get sent to the original poster, or just to you?
And you're right, Administrator isn't the rght place to do it. How about a user specifically for the task, like what ASP does?
My bad on both the post and the idea.
|
|
|
|
|
Only the person you reply to gets a notification email.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm really curious what you want this for.
|
|
|
|
|
Hi!
In my program I'm using a class, which can nested like the TreeNodes in a
TreeView, thus I also want to use a TreeView to display some of the content
(a short string) of these nested classes. The user shall then be able to take
further actions when by clicking on the TreeNodes. Here comes the problem:
How do I map the currently selected TreeNode to the appropriate instance of
the nested class?
|
|
|
|
|
You need a reference to the TreeView, and to set a TreeViewEventHandler for its AfterSelect event. TreeViewEventArgs has a Node property that returns the selected TreeNode.
|
|
|
|
|
Or, the other way around, you can inherit from TreeView, create its nodes dynamically, and set each node's Tag property with an appropriate nested class instance.
|
|
|
|
|
Thanks a lot! That's exactly what I was looking for.
Now I've discovered another problem: The TreeView apparently always selects one node, no matter where I click. I, however have a context menu, which has to react differently, depending on whether the user clicks on a node or in some empty space. So I tried to determine the node at the clicking position with the GetNodeAt() method. This weardily always returns null.
Here's the code (tvAlbums is the TreeView and contMenu the contextMenu):
private void tvAlbums_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
Point pos = new Point(e.X, e.Y);
contMenu.Show(tvAlbums, pos);
pos = tvAlbums.PointToClient(pos);
if(tvAlbums.GetNodeAt(pos) != null)
{ /* a node was selected - adjust contMenu accordingly */}
else
{ /* no node is selected - adjust contMenu accordingly */}
}
}
|
|
|
|
|
Try checking the tvAlbums.SelectedNode property instead of calling GetNodeAt - does it give you the correct Node reference?
whoops -- i mean "in addition to calling GetNodeAt"
|
|
|
|
|
tvAlbums.SelectedNode does return a correct referece to a node, the problem however is that it always returns a node reference, even if the user clicked into the void.
|
|
|
|
|
In that case, a call to
tvAlbums.SelectedNode.Bounds.Contains(new Point(e.X, e.Y))
should tell you whether the node was clicked.
|
|
|
|
|
I forgot to add that you might want to change the value of tvAlbums.FullRowSelect and see what effect that has.
|
|
|
|
|
I've just found a working solution, which for which I cannot find any logical reason though:
When I create a point based on some EventArgs e, I first have to let the point go through a PointToClient operation and let it go through PointToScreen to make the GetNodeAt method to work properly:
Point p = new Point(e.X, e.Y);
p = tvAlbums.PointToClient(p);
p = tvAlbums.PointToScreen(p);
// now tvAlbums.GetNodeAt(p) will work properly
Thanks once again for your help!
|
|
|
|
|
you're very welcome.
Also, I realize upon reading your last message why you need to convert the Point. The MouseEventArgs X and Y properties relate to screen co-ordinates. Controls use co-ordinates based on their parent control's ClientRectangle. The conversion forces the TreeView to determine the screen co-ordinates of its own ClientRectangle, which it otherwise has no need to know.
I don't suppose you know a fast and reliable way to serialize rich text, do you?
|
|
|
|
|
>I don't suppose you know a fast and reliable way to serialize rich text, do you?
Perhaps the .NET baseclasses provide a serializer for rich-text.
|
|
|
|
|
I started investigating the possibilities of NHibernate yesterday and my fisrt conclusion was: Promising technology and stable.
Anyone else working with nhibernate, and want to share his/her experiences with it?
Also I got a question about ms access databases. Can I use them with NHibernate? Anyone did this before?
WM.
What about weapons of mass-construction?
|
|
|
|
|
You'd be much better off asking this question on the SourceForge boards for the project. It's very unlikely this post will stay on thefront page of the forum long enough for anyone with any experience to see it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Actually this post can be closed
I posted a similar message on sourceforge and experimented in the mean time. The result of the experimentation is that:
- MS Access is limited in the number of joins possible
- It does work with NHibernate
- It's time for me to go check out ms sql for the current project I'm planning
WM.
What about weapons of mass-construction?
|
|
|
|
|
When I change the font in NOTEPAD, it apply to all text. I just want to change sellected text What I have to do ??
Thank.
|
|
|
|
|
Whether you can change the font for parts of your text or the whole control only depends on the type of control you're using.
TextBox supports only one type of font, RichTextBox supports several fonts.
They're both well-documented in the framework reference.
mav
|
|
|
|
|
What does this have to do with C#???
Notepad only allows one font. If this not satfisfies you than use another editor (or write your own).
|
|
|
|