Click here to Skip to main content
15,911,711 members
Home / Discussions / C#
   

C#

 
QuestionService will not start Pin
spif20018-Jan-06 21:21
spif20018-Jan-06 21:21 
AnswerRe: Service will not start Pin
krieg388-Jan-06 23:52
krieg388-Jan-06 23:52 
GeneralRe: Service will not start Pin
spif20019-Jan-06 0:18
spif20019-Jan-06 0:18 
GeneralRe: Service will not start Pin
spif20019-Jan-06 3:57
spif20019-Jan-06 3:57 
QuestionCalling Operator Pin
rooz72008-Jan-06 19:49
rooz72008-Jan-06 19:49 
AnswerRe: Calling Operator Pin
Sebastian Schneider8-Jan-06 20:02
Sebastian Schneider8-Jan-06 20:02 
QuestionContext Menu& TreeView Pin
krieg388-Jan-06 18:11
krieg388-Jan-06 18:11 
AnswerRe: Context Menu& TreeView Pin
tarasn8-Jan-06 21:13
tarasn8-Jan-06 21:13 
Here's code snippet that shows different context menus for selected tree node.




private void Form1_Load(object sender, System.EventArgs e)
{

// create the root node
TreeNode treeNodeRoot = new TreeNode("Root");
treeNodeRoot.Tag = "root";

// create first child node
TreeNode treeNodeChild1 = new TreeNode("Child1");
treeNodeChild1.Tag = "child";
treeNodeRoot.Nodes.Add( treeNodeChild1 );

// create second child node
TreeNode treeNodeChild2 = new TreeNode("Child2");
treeNodeChild2.Tag = "child";
treeNodeRoot.Nodes.Add( treeNodeChild2 );

treeView1.Nodes.Add( treeNodeRoot );
}


///
/// Create context menu
///

/// <param name="tag" />tag value
/// <returns>
private ContextMenu GetContextMenuByTag(string tag)
{

ContextMenu contextMenu = new ContextMenu();

if( tag.StartsWith("child") )
{
contextMenu.MenuItems.Add("Child menu item");
}
else
{
contextMenu.MenuItems.Add("Root menu item");
}

return contextMenu;
}


private void treeView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button==MouseButtons.Right)
{

// retrive node or use treeView1.SelectedNode
TreeNode theNode= treeView1.GetNodeAt(e.X, e.Y);
if (theNode!=null)
{
if( theNode.Tag!=null )
{
ContextMenu contextMenu =
GetContextMenuByTag((string)theNode.Tag);
contextMenu.Show( treeView1, new Point(e.X, e.Y) );
}
}
}
}

DevIntelligence.com - My blog for .Net Developers

-- modified at 3:16 Monday 9th January, 2006
AnswerRe: Context Menu& TreeView Pin
S. Senthil Kumar8-Jan-06 21:14
S. Senthil Kumar8-Jan-06 21:14 
GeneralRe: Context Menu& TreeView Pin
krieg388-Jan-06 22:00
krieg388-Jan-06 22:00 
Questioncan we use .net dlls in win32 applicatiuons Pin
abyclassic8-Jan-06 18:03
abyclassic8-Jan-06 18:03 
AnswerRe: can we use .net dlls in win32 applicatiuons Pin
spif20018-Jan-06 21:31
spif20018-Jan-06 21:31 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak9-Jan-06 3:23
mveDave Kreskowiak9-Jan-06 3:23 
AnswerRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak9-Jan-06 3:21
mveDave Kreskowiak9-Jan-06 3:21 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
abyclassic10-Jan-06 19:07
abyclassic10-Jan-06 19:07 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak11-Jan-06 1:05
mveDave Kreskowiak11-Jan-06 1:05 
QuestionRun other applications within my application Pin
AesopTurtle8-Jan-06 14:19
AesopTurtle8-Jan-06 14:19 
AnswerRe: Run other applications within my application Pin
Dave Kreskowiak8-Jan-06 15:44
mveDave Kreskowiak8-Jan-06 15:44 
QuestionMetaFIle Pin
felopater8-Jan-06 14:08
felopater8-Jan-06 14:08 
AnswerRe: MetaFIle Pin
leppie8-Jan-06 18:49
leppie8-Jan-06 18:49 
QuestionCreating logical string Pin
Guinness4Strength8-Jan-06 14:00
Guinness4Strength8-Jan-06 14:00 
AnswerRe: Creating logical string Pin
Colin Angus Mackay8-Jan-06 14:28
Colin Angus Mackay8-Jan-06 14:28 
AnswerRe: Creating logical string Pin
Guinness4Strength8-Jan-06 14:56
Guinness4Strength8-Jan-06 14:56 
Questionget screen coordinate Pin
Sasuko8-Jan-06 13:44
Sasuko8-Jan-06 13:44 
AnswerRe: get screen coordinate Pin
Sasuko8-Jan-06 14:01
Sasuko8-Jan-06 14:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.