避免system.threading.threadabortexception错误(Avoid system.threading.threadabortexception error)
我有一个vb.net桌面应用程序,我在那里使用thread.Abort()。
我收到system.threading.threadabortexception错误。
下面是我得到的错误消息框,但不是每次都有。 您的应用程序中发生了未处理的异常。 如果单击继续.....线程正在中止。
请建议如何避免此错误消息。
I have a vb.net desktop application and I am using thread.Abort() there.
I am getting system.threading.threadabortexception error.
Below is the error messagebox i am getting but not everytime. Unhandled exception has occured in your application. If you click Continue..... Thread was being aborted.
Please suggest how to avoid this errormessage.
原文:https://stackoverflow.com/questions/20360056
最满意答案
好的,我已经在heltonbiker和Clemens的帮助下解决了这个问题。
var size = new Size(794, 122); Document.Measure(size); Document.Arrange(new Rect(size)); Document.UpdateLayout(); RenderTargetBitmap rtb = new RenderTargetBitmap(794, 1122, 96d, 96d, System.Windows.Media.PixelFormats.Default); rtb.Render(Document);
但是当我将画布保存到光盘时,它的背景为黑色。 我通过在Canvas中的XAML中添加一个
Rectangle
来解决这个问题。Okay, I've got it fixed with the help of heltonbiker & Clemens.
var size = new Size(794, 122); Document.Measure(size); Document.Arrange(new Rect(size)); Document.UpdateLayout(); RenderTargetBitmap rtb = new RenderTargetBitmap(794, 1122, 96d, 96d, System.Windows.Media.PixelFormats.Default); rtb.Render(Document);
But when I save my canvas to disc it had a black background. I solved this by adding a
Rectangle
to my XAML inside the Canvas.
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
显示一个隐藏的表单(Showing a hidden form)[2024-02-10]
当您执行以下操作时: MainMenuForm frmMainMenu = new MainMenuForm(); frmMainMenu.Show(); 您正在创建并显示MainMenuForm的新实例。 为了显示和隐藏MainMenuForm的实例,您需要保存对它的引用。 也就是说,当我做紧凑的框架应用程序,我有一个使用单例模式的静态类,以确保我在运行时只有一个表单的实例: public class FormProvider { public static MainMenuForm MainMe ... -
位图不显示在画布上(Bitmap not showing up on canvas)[2023-07-28]
从这改变你的计算: canvasWidth*(memoryManiaHeight/memoryManiaWidth) 对此: (canvasWidth*memoryManiaHeight)/memoryManiaWidth 如果先评估(memoryManiaHeight/memoryManiaWidth)那么由于整数除法,它将评估为零。 Change your calculation from this: canvasWidth*(memoryManiaHeight/memoryManiaWidth) ... -
有一个拼写错误,你拼写了canvasContext错误,错过了一个“n”。 cavasContext.beginPath(); cavasContext.arc(100,75,50,0,2*Math.PI); cavasContext.stroke(); 应该可能是: canvasContext.beginPath(); canvasContext.arc(100,75,50,0,2*Math.PI); canvasContext.stroke(); There is a typo, you've sp ...
-
画布没有显示(Canvas is not showing)[2021-07-10]
你的完整html中没有window.onload。 这就是问题Insert title here 这是一个纠正的小提琴: http : //jsfiddle.net/8bK4y/ 编辑:如下所述,HTML5 Doctype不需要type属性。 I've cleaned up your code you had a few spaces that were causing problems. ...