【发布时间】:2014-10-09 20:44:39
【问题描述】:
我想直接引用 Paint.NET 程序集并以这种方式使用它的功能。我不知道如何使用 .dll 文件 PaintDotNet.Core.dll 并在 C# Visual Studio 中使用它的功能有任何帮助。请
想要引用这些程序集:C:\Program Files\Paint.NET\PaintDotNet.*.dll 然后在这些命名空间中查找类。
代码:-
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
string filename = "";
if (ofd.ShowDialog() == DialogResult.OK)
{
filename = System.IO.Path.GetFullPath(ofd.FileName);
}
// MessageBox.Show(filename, "file");
pictureBox1.ImageLocation = filename;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
DialogResult result = MessageBox.Show("Do you wish to continue?", "Save Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
System.Diagnostics.Process.Start(@"C:\Program Files\Paint.NET\PaintDotNet.exe");
// here i need to perform the function like
//Open + O`
//ctrl + Shift + L)` then `
//(ctrl + Shift + G)`. then save
//`ctrl + Shift + S`
}
else
{
return;
}
}
【问题讨论】:
-
您发布的代码似乎没有使用参考。您是否尝试在 Visual Studio 解决方案->项目中引用它?如果您想自动化程序,您可以尝试使用 Assembly.Load() 将程序加载到您的程序中,然后运行 MainModule 的入口点。不过我对 Paint.NET 一无所知。
-
据我所知,paintdotnet 没有供外部使用的 API。他们只提供在主要paintdotnet应用程序范围内工作的插件开发。
-
对于这样的宏(用于进行一些自动操作的键序列),您不需要 C#。只需使用一些专用工具,例如AutoHotKey。
-
@KonradKokosa 好的,我看到了这个.. 但是我如何使用这些打开图像.. 使用此自动热键转换为 bmp 文件
-
@KonradKokosa 实际上我检查了自动热键..我们需要按任意键来激活这个权利..我不喜欢按任何键..它被激活的那一刻..它应该开始做..似乎很疯狂的仪式..我知道..但我需要这种方式..
标签: c# visual-studio dll dll-reference paint.net