不错的东东
2011-05-14 17:47
232 查看
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace AppleInPicture
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnSelectPicture_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "(*.jpg)|*.jpg|(*.gif)|*.gif";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.tbPicture.Text = ofd.FileName;
}
}
private void btnSelectApple_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Apple file|*.rar;*.zip;*.7z";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.tbApple.Text = ofd.FileName;
}
}
private void btnMake_Click(object sender, EventArgs e)
{
if (this.tbApple.Text.Length == 0 || this.tbPicture.Text.Length == 0)
{
return;
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Image file|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(this.makeCommand(this.tbPicture.Text, this.tbApple.Text, sfd.FileName));
p.StandardInput.WriteLine("exit");
p.WaitForExit();
if (File.Exists(sfd.FileName))
{
MessageBox.Show("製作完成!", "提示");
}
else
{
MessageBox.Show("製作失敗!", "提示");
}
}
}
private string makeCommand(string f1, string f2, string f3)
{
return string.Format("copy /b {0}+{1} {2}", f1, f2, f3);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace AppleInPicture
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnSelectPicture_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "(*.jpg)|*.jpg|(*.gif)|*.gif";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.tbPicture.Text = ofd.FileName;
}
}
private void btnSelectApple_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Apple file|*.rar;*.zip;*.7z";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.tbApple.Text = ofd.FileName;
}
}
private void btnMake_Click(object sender, EventArgs e)
{
if (this.tbApple.Text.Length == 0 || this.tbPicture.Text.Length == 0)
{
return;
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Image file|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(this.makeCommand(this.tbPicture.Text, this.tbApple.Text, sfd.FileName));
p.StandardInput.WriteLine("exit");
p.WaitForExit();
if (File.Exists(sfd.FileName))
{
MessageBox.Show("製作完成!", "提示");
}
else
{
MessageBox.Show("製作失敗!", "提示");
}
}
}
private string makeCommand(string f1, string f2, string f3)
{
return string.Format("copy /b {0}+{1} {2}", f1, f2, f3);
}
}
}
相关文章推荐
- J2SE 6 的新特性,针对性能测试内存泄露而是个不错的东东
- 有关Ajax的一些文章链接,对想了解这个东东的朋友还是不错的
- Lightbox JS不错的东东。。。
- Lightbox JS不错的东东。。。
- 发现的一个不错的技术类网站!有很多好东东啊!!!!
- primefaces不错的东东,整合了YUI和JSF
- PPLive是不错的东东
- (转)UITableView使用详解 相当详细,不错的东东
- 不错的东东
- XSL果然是个好东东,velocity也不错
- 云打印服务器 - 听起来不错的东东
- 不错的东东
- 比较不错的asp单表单字段多条件查询
- 装了iDempiere,感觉不错,截个图。
- 刚刚发现一个蛮不错的,查IT公司的网站。
- 书单推荐(都是一些以前看过的不错的书,不断补充中)
- [转]转一篇不错的文章:ORM 在电子商务系统中的应用
- phper需要了解的东东
- 分享一个非常不错的手机定位网