Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
GeneralRe: Part formating of TextBox.Text Pin
Ray Cassick17-Apr-03 18:36
Ray Cassick17-Apr-03 18:36 
GeneralRe: Part formating of TextBox.Text Pin
A.Wegierski18-Apr-03 0:11
A.Wegierski18-Apr-03 0:11 
GeneralOutlook object question Pin
JasperHotmail17-Apr-03 11:59
JasperHotmail17-Apr-03 11:59 
GeneralRe: Outlook object question Pin
Paresh Gheewala17-Apr-03 12:29
Paresh Gheewala17-Apr-03 12:29 
GeneralTreeview/listfview item selection Pin
vlusardi17-Apr-03 10:58
vlusardi17-Apr-03 10:58 
GeneralRe: Treeview/listfview item selection Pin
Paresh Gheewala17-Apr-03 11:27
Paresh Gheewala17-Apr-03 11:27 
GeneralRe: Treeview/listfview item selection Pin
vlusardi17-Apr-03 11:47
vlusardi17-Apr-03 11:47 
GeneralRe: Treeview/listfview item selection Pin
Paresh Gheewala17-Apr-03 12:26
Paresh Gheewala17-Apr-03 12:26 
Ok Here is the code Wink | ;) what I tried !!!
you can compile and run under shell by
> csc Form1.cs
> Form1

you can derive the TreeView Class and make protected method callable via making public and calling protected method.

Hope this helps or gives hints to your stuff !!!



----------------------------

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WinTreeHandle
{
///
/// Summary description for Form1.
///

public class Form1 : System.Windows.Forms.Form
{
private WinTreeHandle.Form1.MyTree treeView1;

class MyTree : TreeView
{
public void OnMyAfterCheck(TreeViewEventArgs e)
{
e.Node.Checked = true;
this.OnAfterCheck(e);
}
}
private System.Windows.Forms.Button buttonClick;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

bool bLoading = true;
public Form1()
{
bLoading = true;
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
bLoading = false;
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}


#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.treeView1 = new WinTreeHandle.Form1.MyTree();
this.buttonClick = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// treeView1
//
this.treeView1.CheckBoxes = true;
this.treeView1.ImageIndex = -1;
this.treeView1.Location = new System.Drawing.Point(16, 24);
this.treeView1.Name = "treeView1";
this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("Node0"),
new System.Windows.Forms.TreeNode("Node1"),
new System.Windows.Forms.TreeNode("Node2"),
new System.Windows.Forms.TreeNode("Node3"),
new System.Windows.Forms.TreeNode("Node4")});
this.treeView1.SelectedImageIndex = -1;
this.treeView1.Size = new System.Drawing.Size(208, 144);
this.treeView1.TabIndex = 0;
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
//
// buttonClick
//
this.buttonClick.Location = new System.Drawing.Point(240, 32);
this.buttonClick.Name = "buttonClick";
this.buttonClick.Size = new System.Drawing.Size(96, 40);
this.buttonClick.TabIndex = 1;
this.buttonClick.Text = "Click To Raise Event";
this.buttonClick.Click += new System.EventHandler(this.buttonClick_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(344, 221);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonClick,
this.treeView1});
this.Name = "Form1";
this.Text = "Tree Handling";
this.ResumeLayout(false);

}
#endregion


///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void buttonClick_Click(object sender, System.EventArgs e)
{
TreeViewEventArgs e1 = new TreeViewEventArgs(treeView1.Nodes[0],TreeViewAction.ByMouse);
treeView1.OnMyAfterCheck(e1);
}

private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
if ( bLoading ) return;
MessageBox.Show(e.Node.Text);
}

private void treeView1_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
if ( bLoading ) return;
MessageBox.Show(e.Node.Text);
}

}
}


-Paresh
GeneralEscape character question Pin
kensai17-Apr-03 8:56
kensai17-Apr-03 8:56 
GeneralRe: Escape character question Pin
Alvaro Mendez17-Apr-03 10:31
Alvaro Mendez17-Apr-03 10:31 
GeneralRe: Escape character question Pin
Paresh Gheewala17-Apr-03 11:29
Paresh Gheewala17-Apr-03 11:29 
GeneralRe: Escape character question Pin
Waleed Eissa18-Apr-03 0:54
Waleed Eissa18-Apr-03 0:54 
GeneralRe: Escape character question Pin
Waleed Eissa18-Apr-03 1:06
Waleed Eissa18-Apr-03 1:06 
GeneralWork with PropertyGrid Pin
kaloyan17-Apr-03 5:20
kaloyan17-Apr-03 5:20 
GeneralRe: Work with PropertyGrid Pin
Chris Austin17-Apr-03 7:13
Chris Austin17-Apr-03 7:13 
GeneralRe: Work with PropertyGrid Pin
kaloyan17-Apr-03 20:33
kaloyan17-Apr-03 20:33 
QuestionHow to access an event's members? Pin
Alvaro Mendez17-Apr-03 4:50
Alvaro Mendez17-Apr-03 4:50 
AnswerRe: How to access an event's members? Pin
leppie17-Apr-03 11:00
leppie17-Apr-03 11:00 
AnswerRe: How to access an event's members? Pin
Paresh Gheewala17-Apr-03 11:31
Paresh Gheewala17-Apr-03 11:31 
GeneralOdd Exception Pin
Andy H17-Apr-03 3:49
Andy H17-Apr-03 3:49 
GeneralRe: Odd Exception Pin
Le centriste17-Apr-03 4:31
Le centriste17-Apr-03 4:31 
GeneralRe: Odd Exception Pin
Paresh Gheewala17-Apr-03 11:34
Paresh Gheewala17-Apr-03 11:34 
GeneralRe: Odd Exception Pin
Andy H17-Apr-03 19:58
Andy H17-Apr-03 19:58 
GeneralRe: Odd Exception Pin
Vasudevan Deepak Kumar17-Apr-03 22:42
Vasudevan Deepak Kumar17-Apr-03 22:42 
QuestionHow to move object ? Pin
tuan_tomy17-Apr-03 2:09
tuan_tomy17-Apr-03 2:09 

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.