当前屏幕上有多个ellipse画成的圆,如何获取某一个圆,让它的颜色改变?小菜刚接触WPF,请教高手。。谢谢。WPF依赖属性 ELLIPSE控件
解决方案 »
- C#button2的click事件中怎样引用button1click事件,中的变量
- 设置路径这样的功能应该怎么实现
- 当前不会命中断点,没有与此命令行关联的可执行代码
- 关于Winform的问题--TextBox 输入字符以后按回车键Enter转到下一个TextBox框,怎么实现?
- 各位大吓,我对几个概念很模糊,谁能帮我解释一下呢?
- Datagrid怎样显示数组数据?
- 一个winfrom运行两个Timer
- 如何取得和设置dataset中的datatable中的某行的值?
- 求教!C#在数据库开发方面有无优势,与PB,DELPHI,VB相比??
- 请问:为什么我不能using system.data.sql
- .net2010中treeview的节点的value值相同时,实际选中的节点和表现出来的不一致问题!!
- c# 窗体程序(带数据库)在别的电脑无法运行
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" MouseUp="Window_MouseUp" >
<Canvas>
<Ellipse Width="30" Height="30" Fill="Red" Canvas.Left="46" Canvas.Top="41"/>
<Ellipse Width="30" Height="30" Fill="Green" Canvas.Left="74" Canvas.Top="137"/>
<Ellipse Width="30" Height="30" Fill="Blue" Canvas.Left="135" Canvas.Top="67"/>
</Canvas>
</Window>
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;namespace WpfTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
} private void Window_MouseUp(object sender, MouseButtonEventArgs e)
{
Ellipse ellipse = e.OriginalSource as Ellipse;
if (ellipse != null) {
ellipse.Fill = new SolidColorBrush { Color = Colors.Gray };
}
}
}
}