XXXXXXnfig建议把4.0.30319(Win8+带的版本)放在前面,优先匹配.NET 4.x。如果把2.0.50727放前面,控件会变成Win7样式。
<code class="lang-vb">Class MainWindow Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click Dim opendlg As New Microsoft.Win32.OpenFileDialog() If opendlg.ShowDialog() Then imagebox.Source = New BitmapImage(New Uri(opendlg.FileName)) End If End Sub Private Sub MainWindow_Drop(sender As Object, e As DragEventArgs) Handles Me.Drop If e.Data.GetDataPresent(DataFormats.FileDrop) Then Dim filelist As String() = e.Data.GetData(DataFormats.FileDrop) imagebox.Source = New BitmapImage(New Uri(filelist(0))) End If End Sub End Class</code>
<code class="lang-xml"><window x:class="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" xmlns:local="clr-namespace:picview" mc:ignorable="d" title="图片查看器" height="350" width="525" allowdrop="True"> <grid> <button x:name="button" content="打开" horizontalalignment="Left" margin="10,10,0,0" verticalalignment="Top" width="75"> <image x:name="imagebox" margin="10,40,10,10"> </image></button></grid> </window></code>
<code class="lang-xml"><?xml version="1.0" encoding="utf-8"?> <configuration> <startup uselegacyv2runtimeactivationpolicy="true"> <supportedruntime version="v4.0.30319"> <supportedruntime version="v2.0.50727"> </supportedruntime></supportedruntime></startup> </configuration></code>
[修改于 9年0个月前 - 2015/11/22 11:00:21]
时段 | 个数 |
---|---|
{{f.startingTime}}点 - {{f.endTime}}点 | {{f.fileCount}} |
200字以内,仅用于支线交流,主线讨论请采用回复功能。