的創建要求的WPF窗口。
NOTES:
- 設置WindowStyle屬性爲「無」隱藏的標準OS鉻
- 在下面的示例中所引用的圖像不包括
- 的Click Event將需要處理對於「是」和「否」按鈕
<Window x:Class="CustomConfirmBox.ConfirmBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ConfirmBox" Height="275" Width="376"
WindowStyle="None" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="38" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="CornflowerBlue" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
<Image x:Name="ConfirmIcon" Margin="6" Source="Icon.jpg" />
<TextBlock Text="Confirmation" VerticalAlignment="Center" FontSize="20" Foreground="White" />
</StackPanel>
</Border>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="63"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="35" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="1" TextWrapping="Wrap" HorizontalAlignment="Center"
LineStackingStrategy="BlockLineHeight" LineHeight="30" TextAlignment="Center" Margin="0,20" >
Meter data and logs are deleted from the application immediately once
archiving is complete, while structures are kept in the application.
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" TextAlignment="Center" Margin="6" >
Are you sure you want to continue?
</TextBlock>
<Grid Grid.Row="2" Grid.Column="1" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Row="1" Grid.Column="1" x:Name="ButtonYes" Content="Yes"
Background="White" Height="25" Width="73" BorderBrush="LightGray" />
<Button Grid.Row="1" Grid.Column="4" x:Name="ButtonNo" Content="No"
Background="White" Height="25" Width="73" BorderBrush="LightGray" />
</Grid>
</Grid>
</Grid>
</Window>
到目前爲止你做了什麼?你確切的問題是什麼?另外,您不能簡單地更改標準消息框的外觀。你必須創建自己的一個。 – Somedust