in src/AccessibilityInsights.SharedUx/Highlighting/ImageHighlighter.cs [183:249]
public void InitializeWindow()
{
canvas = new Canvas();
var vb = new Viewbox()
{
Child = canvas
};
this.HighlightWindow = new Window()
{
Content = vb,
Title = Properties.Resources.ScreenshotWindowTitle,
Icon = Application.Current.MainWindow.Icon,
MinHeight = 80
};
bdClick = new Border()
{
Child = new TextBlock()
{
FontSize = 28,
Text = Properties.Resources.ScreenshotWindowTitle,
Background = new SolidColorBrush(Colors.White),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
},
Width = 620,
Height = 70,
Visibility = Visibility.Collapsed,
BorderBrush = System.Windows.Media.Brushes.Red,
BorderThickness = new Thickness(5),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
this.HighlightWindow.Closing += onClosing;
this.HighlightWindow.Closed += onClosed;
this.HighlightWindow.MouseDown += onClick;
this.HighlightWindow.MouseEnter += onClick;
canvas.Width = Dimensions.Width;
canvas.Height = Dimensions.Height;
canvas.Children.Add(bdClick);
bdClick.SetValue(Canvas.LeftProperty, (canvas.Width - bdClick.Width) / 2);
bdClick.SetValue(Canvas.TopProperty, (canvas.Height - bdClick.Height) / 2);
canvas.Background = ib;
if (WinRect.IsEmpty)
{
var xyDpi = HelperMethods.GetWPFWindowPositioningDPI();
this.HighlightWindow.Top = Dimensions.Top / xyDpi;
this.HighlightWindow.Left = Dimensions.Left / xyDpi;
var dpi = Dimensions.GetDPI();
this.HighlightWindow.Width = Dimensions.Width / dpi;
this.HighlightWindow.Height = Dimensions.Height / dpi;
}
else
{
this.HighlightWindow.Top = WinRect.Top;
this.HighlightWindow.Left = WinRect.Left;
this.HighlightWindow.Width = WinRect.Width;
this.HighlightWindow.Height = WinRect.Height;
}
HighlightWindow.Show();
}