添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
有胆有识的回锅肉  ·  9.5.1 ...·  2 天前    · 
严肃的双杠  ·  antd ...·  2 天前    · 
失落的饼干  ·  中牟县政府采购网·  4 周前    · 
悲伤的拐杖  ·  (RESOLVED) When ...·  3 月前    · 
<Window x:Class="Demo01.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Demo01" Height="400" Width="600">
        <Grid.ColumnDefinitions>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
<Image Name="img_light1" Grid.Row="0" Grid.Column="2" Width="60" Height="60" Source="res/Light_Close.png"></Image> <Button Click="Button_Click" Grid.Row="0" Grid.Column="3" Height="40" Width="70" Content="开灯"></Button>

</Grid> </Window>

界面效果:

后台代码:

* Created by SharpDevelop. * User: W2268 * Date: 2020/10/26 * Time: 23:31 * To change this template use Tools | Options | Coding | Edit Standard Headers. using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; namespace Demo01 /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window public Window1() InitializeComponent(); void Button_Click( object sender, RoutedEventArgs e) //切换图片逻辑,相对路径 img_light1.Source = new BitmapImage( new Uri( @" res/Light_Open.png " ,UriKind.RelativeOrAbsolute));