有人可以幫我解決這個問題:我怎樣才能將圖形分成不同的字段,這取決於哪個區域是鼠標點擊它會執行一個特定的事件?如何將數字劃分成使用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