效果:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
//存储选的值
public static string str = "";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
TreeViewForm tvf = new TreeViewForm();
//窗体起始位置
tvf.Location=new Point(button1.Location.X,button1.Location.Y);
tvf.Show();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(str.Substring(0,str.Length-1));