标签:des style blog http tar ext
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | private string __filesDir = ""; private void BtnInsertPicture1_Click(object sender, EventArgs e) { //"D:\Administrator\Desktop\未命名_files" __filesDir = Path.GetDirectoryName(fileName) + "\\"+ Path.GetFileNameWithoutExtension(fileName) + "_files"; if (!Directory.Exists(__filesDir)) Directory.CreateDirectory(__filesDir); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "图片文件|*.jpg;*.bmp;*gif;*.png|所有文件|*.*"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { string imgfilename1 = openFileDialog1.FileName; string imgfilename2 = __filesDir + "\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + Path.GetExtension(imgfilename1); File.Copy(imgfilename1, imgfilename2,true); //未命名_files/1312312.jpg // webBrowser1.DocumentText 对相对的路径不认 //imgfilename2 = Path.GetFileName(Path.GetDirectoryName(imgfilename2)) + "/" + Path.GetFileName(imgfilename2); //D:\Administrator\Desktop\未命名_files\1.jpg imgfilename2 = __filesDir + "\\" + Path.GetFileName(imgfilename2); webBrowser1.Document.ExecCommand("InsertImage", false, imgfilename2); } } |
标签:des style blog http tar ext
原文地址:http://www.cnblogs.com/xe2011/p/3799967.html