Silverlight InkPresenter包含一个按钮

时间:2011-11-02 17:22:41

标签: silverlight windows-phone-7

我有一个InkPresenter,我在其上添加一个按钮

  <StackPanel x:Name="SignStackPanel">
        <InkPresenter  x:Name="SighCanvas" Background="White"  Height="346">
            <Button Canvas.Left="6" Canvas.Top="275" Content="Button" 
                    Height="71" Name="Clear" Width="160" Background="#FF9D9D9D" 
                    Click="Clear_Click" />
        </InkPresenter >
  </StackPanel>

我的C#代码是

    private Point currentPoint;
    private Point oldPoint;

    void SighCanvas_MouseMove(object sender, MouseEventArgs e)
    {

        currentPoint = e.GetPosition(this.SighCanvas);

        Line line = new Line() { 
          X1 = currentPoint.X, 
          Y1 = currentPoint.Y, 
          X2 = oldPoint.X, 
          Y2 = oldPoint.Y 
       };
       line.Stroke = new SolidColorBrush(Colors.Purple);
       line.StrokeThickness = 4;

       this.SighCanvas.Children.Add(line);
       oldPoint = currentPoint;
    }

    void SighCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        currentPoint = e.GetPosition(SighCanvas);
        oldPoint = currentPoint;
    }

我正在尝试创建一个简单的绘画应用程序。当我在InkPresenter上画一些东西时,如果我把它拖到按钮上,我的笔画会出现在按钮上。

如何防止笔划出现在按钮上?

0 个答案:

没有答案