有客戶報告說,我們的軟件在他的一臺計算機上運行時會掛起。我們縮小了問題的範圍,使用FormattedText呈現文本,併爲他提供了一個簡單的應用程序供他嘗試,這些應用程序只呈現具有不同字體參數的文本 - 這也會掛起。.NET:繪製文本掛起 - FormattedText錯誤?
這裏的代碼來完成實際的文本繪製位:
Typeface typeface = new Typeface(m_Font, m_FontStyle, m_FontWeight, FontStretches.Normal);
FormattedText ftext = new FormattedText(m_Text, new CultureInfo("en-US"), FlowDirection.LeftToRight, typeface, m_FontSize, m_FontColor);
ftext.TextAlignment = CenterText ? TextAlignment.Center : TextAlignment.Left;
if (m_DrawOutline)
{
Geometry geom = ftext.BuildGeometry(CenterText ? new Point(ftext.Width, 0) : new Point());
dc.DrawGeometry(m_FontColor, DrawOutline ? new Pen(m_OutlineColor, m_OutlineWidth) : null, geom);
}
else
dc.DrawText(ftext, CenterText ? new Point(ftext.Width, 0) : new Point());
程序只是停止響應每當ftext.BuildGeometry,dx.DrawText方法或ftext.Width屬性被稱爲,無論字體和使用的文本參數。這隻發生在一臺計算機上,這是一臺運行Windows 7的觸摸屏筆記本電腦(不確定這是否相關)。我們已經嘗試重新安裝.NET Framework,但這沒有幫助。
有沒有人遇到類似的問題?任何想法如何解決,解決或至少找出更多關於這個問題的原因是什麼?
謝謝。
詳細信息您是否嘗試過更新/降級的圖形卡驅動程序?可以肯定的是,罪魁禍首究竟是從調試器還是進程管理器獲取堆棧。如果最終掛在驅動程序中,它可能是硬件或軟件,但無論如何你都無法直接解決問題。如果它在DirectX或內核中......我不知道可能通過MSDN聯繫micsosoft支持。 – 2010-08-17 15:22:02