有人可以帮我解决这个问题:我怎样才能将图形分成不同的字段,这取决于哪个区域是鼠标点击它会执行一个特定的事件?如何将数字划分成使用SilverLight的字段
private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
//if (!isDragging)
{
//creating of my user control element
NodePicture node = new NodePicture();
node.Width = 100;
node.Height = 100;
//use cursor position as the center of the figure
Point point = e.GetPosition(this);
node.SetValue(Canvas.TopProperty, point.Y - node.Height/2);
node.SetValue(Canvas.LeftProperty, point.X - node.Width/2);
node.MouseLeftButtonDown += controlReletionshipsLine;
LayoutRoot.Children.Add(node);
}
}
private void controlReletionshipsLine(object sender, MouseButtonEventArgs e)
{
//creating parant element of node
ParentNode parentNode = new ParentNode();
//creating connected element of the node
ConnectedNode connectedNode = new ConnectedNode();
//creating node element
NodePicture node = (NodePicture)sender;
//getting the relative position of the element
Point point = e.GetPosition(this);
需要更多细节。你是什么意思的数字? –
例如一个圆圈,我需要将它分成几个部分。@ Myles J – revolutionkpi
它与HTML地图类似吗? – baalazamon