【发布时间】:2010-09-28 23:40:21
【问题描述】:
我正在使用 Windows 性能套件(Microsoft Windows SDK 的一部分)来分析我的示例应用程序。我正在使用带有“显示脏区更新覆盖”选项的“Perforator”,这使我能够查看在应用程序中何时何地重绘区域。
当我将鼠标悬停在 TextBox 控件上时,我看到它被重绘多次并且 CPU 使用率上升。我用一个非常简单的窗口进行了测试,只有一个 TextBox 控件和一个按钮控件。
WPF 在鼠标悬停时重绘控件是否正常? 有什么办法可以减少这种情况吗?
这是我正在使用的窗口
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBox Height="25" Width="150" >
</TextBox>
<Button Margin="10,0,0,0" Height="25">1211</Button>
</StackPanel>
</Grid>
【问题讨论】:
标签: wpf-controls