Exemplo n.º 1
0
        //Thumbドラッグ開始
        private void Thumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            var thumb = sender as Thumb;

            lineName = thumb.Name + "Line";
            int i;

            thumb.Opacity = 1;

            try
            {
                //直線を消す
                Line line = PeaceCanvas.FindName(lineName) as Line;
                line.Visibility = Visibility.Collapsed;
                line.Opacity    = 1;
            }
            catch (Exception)
            {
            }

            //透過設定
            for (i = 0; i < 10; i++)
            {
                if (thumbs[i].Equals(thumb))
                {
                    thumbsLayer[i] = nowLayer;
                }
            }
        }
Exemplo n.º 2
0
        //コマから右ドラッグで直線を引くためのメソッド(右クリック押し込み動作)
        private void ThumbRightDown(object sender, MouseButtonEventArgs e)
        {
            EraseButton.IsChecked   = false;
            nowLayerInk.EditingMode = InkCanvasEditingMode.None;
            var   Thumb      = sender as Thumb;
            Point thumbPoint = Thumb.TranslatePoint(new Point(0, 0), PeaceCanvas);
            Point mousePoint = Mouse.GetPosition(PeaceCanvas);

            lineName = Thumb.Name + "Line";
            Line line = PeaceCanvas.FindName(lineName) as Line;

            if (line != null)
            {
                line.X1 = thumbPoint.X + 14;
                line.Y1 = thumbPoint.Y + 14;
            }

            if (IsDraw)
            {
                IsDraw  = false;
                line.X2 = mousePoint.X;
                line.Y2 = mousePoint.Y;
            }
            else
            {
                IsDraw = true;
            }
        }
Exemplo n.º 3
0
        //thumbから右クリックを離した場合
        private void peaceMouseRightUp(object sender, MouseButtonEventArgs e)
        {
            Line  line       = PeaceCanvas.FindName(lineName) as Line;
            Point mousePoint = Mouse.GetPosition(PeaceCanvas);

            if (IsDraw)
            {
                IsDraw  = false;
                line.X2 = mousePoint.X;
                line.Y2 = mousePoint.Y;
            }
        }
Exemplo n.º 4
0
        //リセットボタンの動作
        private void resetButton(object sender, RoutedEventArgs e)
        {
            Line line;
            int  i;

            //ボタン周りのリセット
            EraseButton.IsChecked   = false;
            nowLayerInk.EditingMode = InkCanvasEditingMode.None;

            //コマのリセット
            for (i = 0; i < 10; i++)
            {
                Canvas.SetLeft(thumbs[i], thumbDefaultPoints[i].X);
                Canvas.SetTop(thumbs[i], thumbDefaultPoints[i].Y);
                lineName          = thumbs[i].Name + "Line";
                line              = PeaceCanvas.FindName(lineName) as Line;
                line.Visibility   = Visibility.Collapsed;
                thumbsLayer[i]    = nowLayer;
                thumbs[i].Opacity = 1;
                line.Opacity      = 1;
            }

            //インクのリセット
            inkCanvasLayer1.Strokes.Clear();
            inkCanvasLayer2.Strokes.Clear();
            inkCanvasLayer3.Strokes.Clear();
            inkCanvasLayer4.Strokes.Clear();

            //スタンプのリセット
            for (; stampIndex > 0; stampIndex--)
            {
                stampImages[stampIndex - 1].Visibility = Visibility.Collapsed;
            }
            for (; sTBIndex > 0; sTBIndex--)
            {
                TextStampCanvas[sTBIndex - 1].Visibility = Visibility.Collapsed;
            }
            TextStampCanvas.Clear();
            stampImages.Clear();
        }
Exemplo n.º 5
0
        //キャンバス上のマウス移動関係
        private void peaceMouseMove(object sender, MouseEventArgs e)
        {
            Point mousePoint = Mouse.GetPosition(PeaceCanvas);
            //直線描画部分
            Line line = PeaceCanvas.FindName(lineName) as Line;

            if (IsDraw)
            {
                line.X2         = mousePoint.X;
                line.Y2         = mousePoint.Y;
                line.Visibility = Visibility.Visible;
            }

            //Stamp押す部分
            if (IsStamp)
            {
                stampImages[stampIndex - 1].Margin = new Thickness(mousePoint.X, mousePoint.Y, 0, 0);
            }
            if (IsTextStamp)
            {
                TextStampCanvas[sTBIndex - 1].Margin = new Thickness(mousePoint.X, mousePoint.Y, 0, 0);
            }
        }