1

通常,我可以将矩形的背景图像更改为以下代码:

ImageBrush brush1 = new ImageBrush();
BitmapImage image = new BitmapImage(new Uri(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\images\\image\\MessageEtkileşim.png"));
brush1.ImageSource = image;
renctangle.Fill = brush1;

但是当我将按钮设置为 renctangle 时,我不会更改按钮背景。我尝试了下面的代码但没有用。

ImageBrush brush1 = new ImageBrush();
BitmapImage image = new BitmapImage(new Uri(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\images\\image\\MessageEtkileşim.png"));
brush1.ImageSource = image;
renctanglebutton.Background = brush1;
4

0 回答 0