|
I need to write a help application for a windows desktop program like the one that appears in many of Microsoft's windows products that includes a Contents tab, Index tab and a Search tab with a results window to the right side. Can anyone offer some direction to help me get started?
Kyle
|
|
|
|
|
Hello eveyone,
I want to handle Visio events from C#. Do you have any idea on how to do this?
Visio object has some Event handlers but I couldn't use them.
|
|
|
|
|
I have a treeview with the nodes inside the treeview. I would like to show the contextMenu on the node selected whenever the node is selected.
Unfortunately, i can't do that because the node is not a control.
Anyone out there can help, please????
Thank you
Regards,
cK
|
|
|
|
|
put a ContextMenu on your Form
private System.Windows.Forms.ContextMenu contextMenu;
Example:
(I used a Treeview (treeview) with 3 Nodes, every Node has one SubNode
and my ContextMenu has two MenuItem's)
Declare two Menu-Items for the ContextMenu:
private MenuItem contextMenuItem1 = new MenuItem();
private MenuItem contextMenuItem2 = new MenuItem();
Add the following Code to your Constructor:
//Initialize Context-Menu
this.treeView.ContextMenu = this.contextMenu;
contextMenuItem1.Text = "Action 1";
contextMenuItem2.Text = "Action 2";
this.contextMenu.MenuItems.Add(0,contextMenuItem1);
this.contextMenu.MenuItems.Add(1,contextMenuItem2);
contextMenuItem1.Click += new System.EventHandler(this.contextMenu_Action_1);
contextMenuItem2.Click += new System.EventHandler(this.contextMenu_Action_2);
Override the MouseDown Event from your Treeview Control:
private void treeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button != MouseButtons.Right) return;
this.contextMenuItem1.Text = "Action 1";
this.contextMenuItem2.Text = "Action 2";
TreeNode selectedTreeNode = this.treeView.GetNodeAt(new Point(e.X,e.Y));
if(selectedTreeNode != null)
{
this.contextMenuItem1.Text = "Action 1 (Selected Node = " + selectedTreeNode.Text + ")";
this.contextMenuItem2.Text = "Action 2 (Selected Node = " + selectedTreeNode.Text + ")";
}
}
Implement the Funktions for the Eventhandler:
private void contextMenu_Action_1(object sender, System.EventArgs e)
{
if(this.contextMenuItem1.Text == "Action 1")
MessageBox.Show("Action 1 fired for Treeview");
else
MessageBox.Show("Action 1 fired for selected Node in Treeview");
}
private void contextMenu_Action_2(object sender, System.EventArgs e)
{
if(this.contextMenuItem2.Text == "Action 2")
MessageBox.Show("Action 2 fired for Treeview");
else
MessageBox.Show("Action 2 fired for selected Node in Treeview");
}
I Hope this was helpfully for you.
rgrds
Martin
|
|
|
|
|
I have solved the problem. Anyway, thank you for your helpful code!!
|
|
|
|
|
{Hi:I'm writing a program in C to shut-down Windows OS; I'm wondering if any of the members know the code,or how to access the "kill" sequence(not the code to load the "shut_downDialogBox)Thanks for your "input")}
|
|
|
|
|
ExitWindowsEx()
look it up in msdn..
|
|
|
|
|
How can I obtain the local IP address in C#?
Thanks much to anyone that can help me!!
|
|
|
|
|
|
I am having problems getting a simple timer to work. I am very new to C#. When I go to compile the code below I get the following error:
An object reference is required for the nonstatic field, method, or property 'TimerTest.mStartTime'
Anyone got any ideas ?
using System;
using System.IO;
using System.Timers;
class TimerTest
{
public DateTime mStartTime;
public static void Main()
{
Timer tmr = new Timer();
tmr.Tick += new EventHandler(OnTimedEvent);
tmr.Interval= 1000;
DateTime mStartTime = DateTime.Now;
Console.WriteLine("Timer test running...");
tmr.Enabled = true;
while(true)
{
}
}
public static void OnTimedEvent(object source, EventArgs e)
{
String timestring;
DateTime now = DateTime.Now;
TimeSpan diff = now.Subtract(mStartTime);
timestring = (diff.Hours.ToString("d2" + ":" + diff.Minutes.ToString("d2") + ":" +
diff.Seconds.ToString("d2"));
Console.WriteLine("{0}",timestring);
}
}
|
|
|
|
|
B. Wood wrote:
public DateTime mStartTime;
public static DateTime mStartTime;
Since your methods are static, the data it accesses must be static, or have a reference to an instance of the class.
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Thanks James, that did the trick.
|
|
|
|
|
Hi,
is there a possibility to call functions from a DLL written with C# from managed/unmanaged c++ code?
I know it is very simple to create a C#DLL and then use the function in a C# Project with adding a reference. This is really great and simple.
But...
I have a very big project written with VC++6.0. I solved all problems after converting it to VC++7.0. But now I want to use the big, great new features like ADO.NET to connect to a SQL-Server. So I thought to write some C#DLLs with all the functions I need and then call these functions from C++. How can I do this?
I tried several things.
1.) Is it possible to add a reference to a C#Dll from C++ ? I can't see a posibility...
2.) The old common way with LoadLibary is not possible, because I can't declare my function in the Dll as a dllexport function, and because of this GetProcAdress returns zero.
So how can I declare my function for external use ?
Any ideas??
Thanks for help.
|
|
|
|
|
The easiest thing to do would be to wrap your C# dll with COM (C# classes can be exposed as COM objects), then you can use COM to call into your C# dll...
In MC++ you might be able to #using your dll like you would the system dlls.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
The easiest way is to write an unmanaged C++ library that exports the functions you want. It then contains managed C++ that calls your C# classes directly. This gives you the best of both worlds, but requires two files. One for C++ and one cor C#.
|
|
|
|
|
ohhh! I forgot about that
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hello everybody,
Does anyone know how to trap the arrow keys in a class derived from usercontrol?
I noticed that the arrows keys don't fire a keyup, keydown or keypress event,
instead they move the focus to other controls on the form like the Tab key does.
I want the control itself to be able to process the arrows keys without having to add code to the form that is it in.
Thanks in advance
Paul
|
|
|
|
|
Look at the IsInputKey protected method on the usercontrol.
protected override bool IsInputKey(Keys keyData)
{
this control,
if (keyData == Keys.Left ||
keyData == Keys.Right ||
keyData == Keys.Up ||
keyData == Keys.Down)
return true;
else
return base.IsInputKey(keyData);
} Then I think the OnKey* events will fire for it, the docs aren't too clear on that aspect.
Your control will have to have the UIPermission.AllWindows security permission to run that code however.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hi everyone,
I have a web forms page, which contains a dropdownlist. The dropdownlist posts back to an event handler which adds a new button to the controls collection of a PlaceHolder. The text property of this button is set to the text of the DropDownList's selected item. My problem is that after the first time I select my dropdownlist, it changes the text of the existing button in the PlaceHolder, as apposed to adding a new Button to the placeholder.
How can I do that?
I very much appreciate any help I can get this on this.
Thanks.
|
|
|
|
|
Try searching the DOTNET mailing list archives; here is one post that might help a little bit, though I could have sworn I've seen more similar to what you're trying to find.
Sorry I can't be of more help,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
I need implement a singleton in C#. I have tried making a static class but I seem to be getting members that go out of scope. What is the best was to do this? Thanks.
Steve
|
|
|
|
|
|
Here is a really good article on the Singleton Design Pattern.
Is show it in C++ and then the code convert as is to C# and then a better way of doing it in C# that takes advantage of the language. The C# way is easier. Take a look at the URL
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/singletondespatt.asp
Odis Wooten
odis@msn.com
|
|
|
|
|
Can anyone tell me how i get the controls on my C# form to display in an XP style, when the form is running on XP?
Any ideas welcome!
kenbloke
|
|
|
|
|
When you run your application on XP it display in XP style,even it is C#,VC or VB programs.Maybe you change your Appearence to classic style in control panel
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|