好吧所以我想屏幕捕获我正在工作的应用程序的布局我想将屏幕截图设置为按钮或应用程序栏项目,并在捕获后直接进入电子邮件与该屏幕截图发送
我在这里看到:How to take a screenshot and send by email programaticly on dotnet
在这里:C# Take ScreenShot of .net control within application and attach to Outlook Email
但是我不确定它是否适用于Windows Phone 8.我知道你可以通过主页按钮和电源按钮截取屏幕截图但我希望如果可能的话一下子完成
我最初会填写文本框,并且他们生成的电子邮件看起来像这样
private void email_Click(object sender, EventArgs e)
{
EmailComposeTask emailComposeTask = new EmailComposeTask();
string first = infoBox1.Text;
string second = infoBox2.Text;
string third = infoBox3.Text;
string fourth = infoBox4.Text;
string one = amountBox1.Text;
string two = amountBox2.Text;
string three = amountBox3.Text;
string four = amountBox4.Text;
emailComposeTask.To = "";
emailComposeTask.Body =
first + " " + " " + " " + " " + " " + " " + " " + one + Environment.NewLine +
second + " " + " " + " " + " " + " " + " " + " " + two + Environment.NewLine +
third + " " + " " + " " + " " + " " + " " + " " + three + Environment.NewLine +
fourth + " " + " " + " " + " " + " " + " " + " " + four + Environment.NewLine;
但我不喜欢它的输出,没有正确对齐等等...提前感谢!
答案 0 :(得分:1)
只需点击按钮即可使用此代码..
private void ApplicationBarIconButton_Click(object sender, EventArgs e)
{
var fileName = String.Format("WmDev_{0:}.jpg", DateTime.Now.Ticks);
WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
bmpCurrentScreenImage.Render(LayoutRoot, new MatrixTransform());
bmpCurrentScreenImage.Invalidate();
SaveToMediaLibrary(bmpCurrentScreenImage, fileName, 100);
MessageBox.Show("Captured image " + fileName + " Saved Sucessfully", "WmDev Capture Screen", MessageBoxButton.OK);
string currentFileName = fileName;
}
然后使用此代码将图像保存在相机胶卷上..
public void SaveToMediaLibrary(WriteableBitmap bitmap, string name, int quality)
{
using (var stream = new MemoryStream())
{
// Save the picture to the Windows Phone media library.
bitmap.SaveJpeg(stream, bitmap.PixelWidth, bitmap.PixelHeight, 0, quality);
stream.Seek(0, SeekOrigin.Begin);
new MediaLibrary().SavePicture(name, stream);
}
}
现在您可以检查您的相机胶卷,捕获的屏幕将被保存 确保一旦检查了WMAppManifest.xml并且能够检查所有功能,然后运行您的代码我相信它会起作用
答案 1 :(得分:0)
要拍摄截屏,您可以点这个链接..
并且在Windows Phone 8 SDK中无法通过带有附件的电子邮件任务发送电子邮件。