C# WindowsForm エクスプローラ Form1.cs ― 2022年08月25日 11:57
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Shell;
namespace myExprore
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Shown(object sender, EventArgs e)
{
explorerBrowser1.Navigate((ShellObject)KnownFolders.Desktop);
}
private void explorerBrowser1_NavigationComplete(object sender, Microsoft.WindowsAPICodePack.Controls.NavigationCompleteEventArgs e)
{
//
}
private void button1_Click(object sender, EventArgs e)
{
string mylocation;
ShellObject myfolder;
//mylocation = "c:\\aaa\\example";
mylocation = textBox1.Text;
myfolder= ShellObject.FromParsingName(mylocation);
explorerBrowser1.Navigate(myfolder);
}
private void explorerBrowser1_SelectionChanged(object sender, EventArgs e)
{
ShellObjectCollection items = explorerBrowser1.SelectedItems;
textBox1.Text = items[0].ParsingName;
}
}
}
コメント
トラックバック
このエントリのトラックバックURL: http://tukasa.asablo.jp/blog/2022/08/25/9520623/tb