亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問下我在WPF里面怎設置點擊butooin改變butooin的背景圖片啊?

請問下我在WPF里面怎設置點擊butooin改變butooin的背景圖片啊?

拉丁的傳說 2018-08-10 05:06:17
<Button Canvas.Left="159" Canvas.Top="87" Height="35" Name="button2" Width="36" IsCancel="False" Click="button2_Click">                <Image Source="/WpfApplication1;component/bin/Debug/結束.png"></Image>             </Button>//停止服務        private void button2_Click(object sender, RoutedEventArgs e)        {            Uri uri = new Uri("結束-灰色.png", UriKind.Relative);            BitmapImage bimg = new BitmapImage(uri);            button2.Background = new ImageBrush(bimg);        }現在我在Click事件里面寫沒效果?
查看完整描述

2 回答

?
元芳怎么了

TA貢獻1798條經驗 獲得超7個贊

 private void button2_Click(object sender, RoutedEventArgs e)
        {
            Uri uri = new Uri("圖片路徑", UriKind.Relative);
            BitmapImage bimg = new BitmapImage(uri);
            button2.Background = new ImageBrush(bimg);
        }

在Windows Phone8 里面不能這樣寫?。?/p>

它說button2.Background = new ImageBrush(bimg);有錯


查看完整回答
反對 回復 2018-08-14
  • 2 回答
  • 0 關注
  • 663 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號