我想知道是否可以“截屏”一个元素而不在屏幕上显示它。
例如,这个StackPanel
:
private void Button_Click(object sender, RoutedEventArgs e)
{
StackPanel sp = new StackPanel();
sp.Children.Add(new Button { Content = "Bouton 1" });
sp.Children.Add(new Button { Content = "Bouton 2" });
sp.Children.Add(new Button { Content = "Bouton 3" });
sp.Children.Add(new Button { Content = "Bouton 4" });
sp.Children.Add(new Button { Content = "Bouton 5" });
// Take screenshot of sp
}
我认为这是不可能的,因为没有渲染大小,但我想确定一下。
谢谢 !