| Jonathan 的个人资料Jon's Vista Gadgets Blog日志列表 | 帮助 |
|
|
7月3日 How to find the IFrame size in WPFWhilst coding a Mandelbrot explorer, I needed to find the IFrame size in pixels to produce a Bitmap the same size. After a lot of wasted time searching the net, via trial and error I came up with the following method: Assuming you're using a Grid to hold your elements: <Grid Name="myGrid"> ... </Grid> To get the IFrame's size, we get the XAML page's parent, which is a ContentPresenter that holds the width/heigh in pixels: Dim browser As System.Windows.Controls.ContentPresenter = VisualTreeHelper.GetParent(myGrid.Parent) Dim width As Integer = browser.ActualWidth Dim height As Integer = browser.ActualHeight |
|
|