网页生成工具,图片格式转换,文件夹相关
来源:互联网 发布:守望先锋各个性能数据 编辑:程序博客网 时间:2024/05/18 15:07
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Drawing.Imaging;using System.IO;namespace 网页生成工具{ public partial class Form1 : Form { public Form1( ) { InitializeComponent (); } string imageAdd; string fileName; string txt; private void button2_Click(object sender, EventArgs e) { openFileDialog1.Filter = "ALL file|*.*|bmp file|*.bmp|jpeg file|*.jpg|gif file|*.gif";//过滤文件 if (openFileDialog1.ShowDialog () == DialogResult.OK) { int num = openFileDialog1.SafeFileName.IndexOf ("."); fileName = openFileDialog1.SafeFileName.Remove(num); try { Bitmap bt = new Bitmap (openFileDialog1.FileName);//button2_Click里面所使用的pictureBox1.Image.Save方法必须通过Bitmap才能使用 this.pictureBox1.Image = bt;//若此处两行改为pictureBox1.Load方法则,button2_Click里面所使用的pictureBox1.Image.Save出错! } catch (Exception)//异常处理 { MessageBox.Show ("不支持该文件类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } textBox1.Text = fileName; } private void button1_Click(object sender, EventArgs e) { imageAdd=textBox2.Text+ @"\"+fileName+".jpg"; pictureBox1.Image.Save (imageAdd, ImageFormat.Jpeg); FileStream fs1 = new FileStream (textBox2.Text + @"\" + fileName + ".htm", FileMode.Create, FileAccess.Write);//创建写入文件 StreamWriter sw = new StreamWriter (fs1,Encoding.Default); imageAdd = "\"" + imageAdd + "\""; txt=string.Format("<img src={0} border="+"0"+"></body></html>",imageAdd); sw.WriteLine ("<html><head><title>123</title></head><body>", System.Text.Encoding.UTF8); sw.WriteLine (txt,System.Text.Encoding.Default); sw.Close(); fs1.Close (); MessageBox.Show ("生成成功"); } private void Form1_Load(object sender, EventArgs e) { textBox2.Text=@"C:\网页文件"; } private void button4_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start ("Explorer.exe", textBox2.Text); } }}
0 0
- 网页生成工具,图片格式转换,文件夹相关
- 图片格式转换转换工具
- 图片格式转换工具制作
- 图片操作工具类(等比缩放,生成,图片格式转换)
- Linux ImageMagick 转换图片格式工具
- 闪客工具 图片格式转换工具
- Python中判断图片格式并进行转换,将转换的图像保存到生成的文件夹中
- Linux ImageMagick 转换图片格式工具及命令
- 自己写的图片格式转换工具
- java 图片处理【万能图片格式转换工具】
- 图片格式转换收缩和添加水印工具
- 转换图片格式
- 转换图片格式
- 图片格式转换
- 图片格式转换
- 图片格式转换
- 图片格式转换
- 图片格式转换
- POJ1001 Exponentiation--浮点数的高精度乘法
- poj 2513 Colored Sticks——字典树,并查集,欧拉图,哈希表
- 连连看游戏,2点是否可消除算法分析
- HDU 六度分离(Floyd)
- 杭电 2067
- 网页生成工具,图片格式转换,文件夹相关
- hdu2099 整除的尾数
- ORACLE DG 激活 activate database
- HDU 一个人的旅行(Dijkstra)
- 快速幂取模
- 如何解决…has been modified since the precompiled header… was built的问题
- linux 下查看java安装目录
- poj 1276 Cash Machine(多重背包)
- C# OFFICE WORD EXCEL操作