コメント |
http://support.microsoft.com/kb/307966/ja
[[コントロールの AllowDrop を true にする]]
@DIV
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace MyApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
[[this.出力場所.DragDrop += new DragEventHandler(this.出力場所_DragDrop);
this.出力場所.DragEnter += new DragEventHandler(this.出力場所_DragEnter);]]
}
private void 参照ボタン_Click(object sender, EventArgs e)
{
FolderBrowserDialog fd = new FolderBrowserDialog();
DialogResult ret = fd.ShowDialog();
if (ret == DialogResult.OK)
{
this.出力場所.Text = fd.SelectedPath;
}
fd.Dispose();
}
private void 実行_Click(object sender, EventArgs e)
{
File.Copy(Application.ExecutablePath, this.出力場所.Text + @"\test.exe");
}
[[ private void 出力場所_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
e.Effect = DragDropEffects.All;
}
else {
e.Effect = DragDropEffects.None;
}
}
private void 出力場所_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
this.出力場所.Text = s[0];
}]]
}
}
@END
|