C# WindowsForm エクスプローラ Form1.cs2022年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

<< 2022/08
01 02 03 04 05 06
07 08 09 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

このブログについて

ネットで見つけたいろいろ雑記

バックナンバー

RSS