这是Windows应用程序,没有HTML
追答搞错了,应用中没有直接的控件,一般是用一个按钮弹出文件操作窗口,给你一个例子函数。
private void butSendFile_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "所有文件|*.*";
if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
System.IO.FileInfo fInfo = new System.IO.FileInfo(fd.FileName);
if (fInfo.Length / (1024 * 1024 * 10) > 0)
{
MessageBox.Show("您传送的文件太大,请联系对方及时接收。", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
sendFileRequest(fd.FileName);
}
else
{
LanMsg.MyPicture pic = new MyPicture();
pic.FileName = fd.FileName.ToString();
System.Random R = new Random();
pic.Tag = R.Next(2000, 20000);
pic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
pic.Image = System.Drawing.Image.FromFile(GlobalSetting.CurrDir + "\\Resources\\file.gif");
this.RTBSend.InsertMyControl(pic);
this.RTBSend.InsertLink(fInfo.Name + "\n");
this.SendGifs.add(pic);
}
}
}
具体一点呢?我不会用openfiledialog
追答先引用命名控件 system.io 然后你就可以用 openfiledialog类了
openfiledialog ofd = new openfiledialog ();
ofd.showdialog();