您的位置:首页 > 其它

WPF 中获取系统信息

2010-06-12 06:45 507 查看
首先添加 mscorlib assembly的命名空间引用

xmlns:r="clr-namespace:System;assembly=mscorlib"

XAML代码

<TextBlock>
<Label Content="Operating System Version : "></Label>
<Label Content="{x:Static r:Environment.OSVersion}"></Label>
<LineBreak></LineBreak>
<Label Content="Dot NET Version : "></Label>
<Label Content="{x:Static r:Environment.Version}"></Label>
<LineBreak></LineBreak>
<Label Content="Machine Name : "></Label>
<Label Content="{x:Static r:Environment.MachineName}"></Label>
<LineBreak></LineBreak>
<Label Content="User Name : "></Label>
<Label Content="{x:Static r:Environment.UserName}"></Label>

<LineBreak></LineBreak>
<Label Content="User Domain Name : "></Label>
<Label Content="{x:Static r:Environment.UserDomainName}"></Label>
<LineBreak></LineBreak>
<Label Content="System Directory : "></Label>
<Label Content="{x:Static r:Environment.SystemDirectory}"></Label>

</TextBlock>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: