View plaincopyprint?
The WebBroswer control placed in Windows in WPF cannot be displayed:
The source code is as follows:
[Html]
<Window x: Class = "MutilScreenDemo. MainWindow"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: d = "http://schemas.microsoft.com/expression/blend/2008"
Xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
Title = "MainWindow"
AllowsTransparency = "True"
Background = "Black"
BorderBrush = "Transparent"
BorderThickness = "0"
D: design height = "348"
D: DesignWidth = "892"
Loaded = "Window_Loaded"
ResizeMode = "NoResize"
WindowStyle = "None"
Mc: Ignorable = "d">
<Grid x: Name = "layoutRoot">
<Grid. RowDefinitions>
<RowDefinition Height = "100" type = "regxph" text = "yourobjectname"/>
<RowDefinition Height = "*"/>
</Grid. RowDefinitions>
<Rectangle Height = "2"
VerticalAlignment = "Bottom"
Fill = "White"/>
<TextBlock Name = "txtShow"
Grid. Row = "0"
HorizontalAlignment = "Left"
VerticalAlignment = "Center"
FontSize = "50"
FontWeight = "Bold"
Foreground = "Red"
Text = "Hello World! "/>
<StackPanel Grid. Row = "0"
HorizontalAlignment = "Right"
VerticalAlignment = "Center"
Orientation = "Horizontal">
<Button Name = "button1"
Margin = "5"
HorizontalAlignment = "Right"
VerticalAlignment = "Top"
Click = "button#click"
Content = "Get Screen Info"
Padding = "20"/>
<Button Name = "btnShutdown"
Margin = "5"
HorizontalAlignment = "Right"
VerticalAlignment = "Top"
Click = "btnShutdown_Click"
Content = "ShutDown App"
Padding = "20"/>
</StackPanel>
[Html]
[Html]
<WebBrowser Name = "broswer"
Grid. Row = "1"/>
</Grid>
/Window>
Display Effect:
After tossing and trying, the problem lies in the AllowsTransparency attribute in the Window. When the WebBroswer control is displayed and AllowsTransparency is True, there is a conflict.
After AllowsTransparency is removed, the following results are displayed:
But I have no idea what it will do. Hope you can give me some advice !!