|
2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
|
|
|
|
|
I love your screen name.
Have you seen this thread? [^]
|
|
|
|
|
do you have any idea about hooks in VC?
you can track the activities of a user by using hooks. just read about how to implement hooks in c#.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Hello
Let's say I have two forms, form1 and form2. Form1 have only one button and now each time I click this button form2 should show in the front of form1.
Well whats the best practice in doing such thing ? I mean I can create
one instance of form2 in the form1's constructor and then use only
Show() and Hide() methods of form2 or create new instance of form2
each time i click button on form1.
I'm not sure if my problem is clear enough . Let me now if you need more details.
greetings
tommy
|
|
|
|
|
It all depends on what you want to do with your form.
Check Form.BringToFront() method
|
|
|
|
|
Can't you show it as modal?
|
|
|
|
|
Hi...
I want to read a string from a dll & i want to print it in a rich text box on windows form.
How can i do this...?
How i can define a function which will return a string in dll file so that i can call that function from my form class & get the string to display on form...?
Thanks,
Vinay
|
|
|
|
|
Erhmpff... this is really back to basic...
Create a solution with two projects
- Executable project (name : ExeProject)
- Class library (name DllClassLibrary)
in the class lib. create a class containing the following function :
public string MyRichText()
{
StringBuilder sbMyText = new StringBuilder();
sbMyText.Append("Text text text and even more text");
return sbMyText.ToString();
}
Then from your executable project, create a reference to the class lib and add a form containing a textbox. Name the textbox for instance txtTextFromDll
In the Load event of your form add the following lines :
DllClassLibrary.ClassName objMyClass = new DllClassLibrary.ClassName();
txtTextFromDll.Text = objMyClass .MyRichText();
you're pretty done there (except for when i miss something)
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Hi
How can i initilize if screen resolution changed?
I want to do some actions when screen resolution changed.
Help me please...
|
|
|
|
|
Hello,
Microsoft.Win32.SystemEvents.DisplaySettingsChanged += newEventHandler(this.DisplayChanged);
public void DisplayChanged(object sender, EventArgs e)
{
}
should do it.
Hope that helps.
All the best,
Martin
|
|
|
|
|
Hello Martin
You are cool!
You solved my problem ontime (fast, easy, complete);
My problem is controlling form object size in order to monitor resolution,
briefly "Auto Resizing Form Controls".
I couldn't solve this problem with "Dock" and "Anchor" properties.
Anyway, Tanx.
Regards.
|
|
|
|
|
I'm happy if you are! :->
|
|
|
|
|
I am new to C# you are requested to please guide.
I have very simple application.
1. Main Menu (File: Open, save, exit);
2. A tree view
3. Context Menu and ImageList
I have loaded xml file using open dialgoue. With XmlTextReader I have loaded xml file in tree view.
Please guide me from here below:
Now I want to add a context (pop-up) menu. That will enable me to add a node under three categories:
1. Before Node (Same level)
2. After Node (Same Level)
3. Child Node
If root node selected I would be able to ADD only child node in the tree. Means contextMenu will show only child enabled.
If element node selected I would be able to add before, after nodes or a child node. (Before and After creates element on same level under root).
Also I want cut, copy and paste functionality in context menu. That will enable me to cut, copy and paste nodes.
Save in MainMenu will enable me to save changes in according to tree modification.
Please tell me by examples. What steps should be taken? Waiting for your reply.
If user right clicks on node context menu appears and user select appropriately from enable menu for the selected node.
-- modified at 8:28 Tuesday 14th November, 2006
|
|
|
|
|
Thank you for letting us know that. Did you have a question you wanted to ask?
|
|
|
|
|
now check again please.
|
|
|
|
|
Well if you create a ContextMenu(Strip) which you assign to the treeview. There's an event for that which is fired when the menu is displayed (can't remember the name of it).
If you handle that event then you can decide which menu items to display. Then when a menu node is clicked you need to decide which context it's been fired in (i.e. sub node etc) and perform the appropriate actions.
To copy / paste the treenodes I'm not sure how to accomplish this at the moment using the clipboard (easily anyway), if it's to be handled by the program then you could just store a copy of the code in a local variable and delete it from the tree and move it to the appriopriate place.
|
|
|
|
|
This is ugly ugly code but ...
Uses a TreeView treeView1
ContextMenu cMenu;
int count;
public Form1()
{
InitializeComponent();
cMenu = new ContextMenu(new MenuItem[]
{
new MenuItem("Add before", new EventHandler(mi_Click)),
new MenuItem("Add after", new EventHandler(mi_Click)),
new MenuItem("Add child", new EventHandler(mi_Click))
});
treeView1.Nodes.Add(createNode());
}
private TreeNode createNode()
{
TreeNode tn = new TreeNode("Node" + (count++).ToString());
tn.ContextMenu = cMenu;
tn.ContextMenu.Tag = tn;
return tn;
}
void mi_Click(object sender, EventArgs e)
{
MenuItem mi = (MenuItem)sender;
TreeNode sourceNode = (TreeNode)mi.Parent.Tag;
switch (mi.Parent.MenuItems.IndexOf(mi))
{
case 0:
if (sourceNode.Parent != null)
sourceNode.Parent.Nodes.Insert(sourceNode.Index, createNode());
break;
case 1:
if (sourceNode.Parent != null)
sourceNode.Parent.Nodes.Insert(sourceNode.Index + 1, createNode());
break;
case 2:
sourceNode.Nodes.Add(createNode());
break;
}
}
|
|
|
|
|
I am a newbie to C#. I was trying to refresh a drawing in a UI panel. Can I set a timer to call itself after 1 second? The event type is a PaintEvent and I don't know how to call this event.
If anyone could help I would be grateful.
|
|
|
|
|
Hello,
You could use Invalidate or Refresh.
All the best,
Martin
|
|
|
|
|
Hello,
t2o2uk wrote: I don't know how to call this event
In general you can not call this event directly.
If you inherit a class from System.Windows.Forms.panel, you could override the OnPaint Method which is called from the event.
This would be recomended if you whant to change the behavior or style of more than one panel in your application.
Hope that helps.
All the best,
Martin
|
|
|
|
|
Add a Timer control to the page that you can use to update periodically. At each tick you call the Invalidate method of the control that you want to update, and it will be redrawn.
---
b { font-weight: normal; }
|
|
|
|
|
Was just whipping up a quick util which immediately executes an assembly normally run by a winservice at night. The assembly implements an interface exposing a DoWork() function.
I decided to play with the BackgroundWorker component to keep my utils UI responsive and show a little animation while it chugs along. So I have a worker class which essentially implements the interface and calls DoWork().
I thought it would be cool to implement a cancel button while I was at it. BackgroundWorker supports a CancelAsync() which requires the worker thread to check backgroundWorker.CancellationPending and then return. But what if my worker is calling in to an assembly which is performing the long process?
Just curious if there is a way to forcing a BackgroundWorker to immediately cancel. A call to Dispose() was ignored and I didn't see a way to force the thread to exit immediately.
|
|
|
|
|
There isn't a way, no. You can terminate the thread via Thread.Abort, but that's generally a bad idea since it can leave your code in a volatile, unstable state.
I recommend having your background worker spawn a new thread in the DoWork handler. Have that thread do the actual work, while the DoWork thread do 2 things: continually check for the cancel flag, and continually watch for completion of the spawned thread. When either the spawned thread finishes or the cancel flag is true, your DoWork thread can return, thus your RunWorkerCompleted handler will be fired.
p.s. check out Roy Osherove's extended BackgroundWorker[^], which includes a CancelImmediately() method that accomplishes pretty much what you're trying to do.
|
|
|
|
|
I make a chart in steema tchart and convert it in EPS file.
and now showing it in Latex, but it not work because EPS file is not standard.
Anybody please tell me what should i have to do?
Tahnks
ArvindHaritus
|
|
|
|
|
Hey guys,
I display a tooltip whenever a mouse moves over an item in my listview control. However, the width/height of the tool tip is determined by the content inside the tool tip. is it possible to override this and display a fixed width tool tip?
|
|
|
|