コード例 #1
0
 /// <summary>
 /// カスタム図形の色設定
 /// </summary>
 /// <param name="figure"></param>
 private void setCustomColor(ClsFigure figure)
 {
     paintBrush.Color = figure.fillColor;
     paintPen.Color   = figure.lineColor;
     paintPen.Width   = figure.lineWidth;
     paintTextColor   = figure.textColor;
     paintTextFont    = figure.textFont;
 }
コード例 #2
0
ファイル: ClsFigure.cs プロジェクト: srrrkn/ScShoAlpha
    public ClsFigure castClassFigure()
    {
        ClsFigure _copy = new ClsFigure();

        _copy._figCat    = _figCat;
        _copy._lineWidth = _lineWidth;
        _copy.linePen    = (Pen)linePen.Clone();
        _copy.fillBrush  = (Brush)fillBrush.Clone();
        _copy.lineColor  = lineColor;
        _copy.fillColor  = fillColor;
        _copy.textFont   = textFont;
        _copy.textColor  = textColor;
        return(_copy);
    }
コード例 #3
0
 /// <summary>
 ///     ''' マウスボタンアップ
 ///     ''' </summary>
 ///     ''' <param name="sender"></param>
 ///     ''' <param name="e"></param>
 ///     ''' <remarks></remarks>
 private void PanelPaint_MouseUp(System.Object sender, System.Windows.Forms.MouseEventArgs e)
 {
     //
     if (e.Button == MouseButtons.Left)
     {
         // ドラッグ終了
         if (isPainting)
         {
             isDragging = false;
             endPoint.X = e.X;
             endPoint.Y = e.Y;
         }
         //文字入力終了
         if (isInputtingText)
         {
             if (checkBoxBrush.Checked)
             {
                 textBrush = paintBrush;
             }
             else
             {
                 textBrush = new SolidBrush(TransparentColor);
             }
             if (checkBoxLine.Checked)
             {
                 textPen = paintPen;
             }
             else
             {
                 textPen = new Pen(TransparentColor, 1);
             }
             ClsFigure gText = new ClsGText(textPen, textBrush, paintTextFont, paintTextColor,
                                            inputTextBox.Left, inputTextBox.Top,
                                            inputTextBox.Width, inputTextBox.Height, inputTextBox.Text);
             inputTextBox.Dispose();
             isPainting      = false;
             isInputtingText = false;
             figList.Add(gText);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = gText.castClassFigure();
         }
         // パーツ確定
         if (isPaintingRectangle)
         {
             int       leftTopX = startPoint.X > endPoint.X ? endPoint.X : startPoint.X;
             int       leftTopY = startPoint.Y > endPoint.Y ? endPoint.Y : startPoint.Y;
             ClsFigure rect     = new ClsRectangle(paintPen, paintBrush,
                                                   leftTopX, leftTopY,
                                                   Math.Abs(endPoint.X - startPoint.X), Math.Abs(endPoint.Y - startPoint.Y));
             figList.Add(rect);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = rect.castClassFigure();
         }
         else if (isPaintingEllipse)
         {
             int       leftTopX = startPoint.X > endPoint.X ? endPoint.X : startPoint.X;
             int       leftTopY = startPoint.Y > endPoint.Y ? endPoint.Y : startPoint.Y;
             ClsFigure elps     = new ClsEllipse(paintPen, paintBrush,
                                                 leftTopX, leftTopY,
                                                 Math.Abs(endPoint.X - startPoint.X), Math.Abs(endPoint.Y - startPoint.Y));
             figList.Add(elps);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = elps.castClassFigure();
         }
         else if (isPaintingLine)
         {
             ClsFigure line = new ClsLine(paintPen,
                                          startPoint.X, startPoint.Y,
                                          endPoint.X, endPoint.Y);
             figList.Add(line);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = line.castClassFigure();
         }
         else if (isPaintingArrow)
         {
             ClsFigure arrow = new ClsArrow(paintPen,
                                            startPoint.X, startPoint.Y,
                                            endPoint.X, endPoint.Y);
             figList.Add(arrow);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = arrow.castClassFigure();
         }
         else if (isPaintingText)
         {
             //入力用リッチテキストボックスの設定
             inputTextBox = new AlphaControls.AlphaRichTextBox();
             if (checkBoxBrush.Checked && brushColor.A > 0)
             {
                 inputTextBox.BackAlpha = brushColor.A;
                 inputTextBox.BackColor = Color.FromArgb(brushColor.R, brushColor.G, brushColor.B);
             }
             else
             {
                 inputTextBox.BackAlpha = 0;
                 inputTextBox.BackColor = Color.White;
             }
             inputTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
             inputTextBox.Font        = paintTextFont;
             inputTextBox.ForeColor   = paintTextColor;
             inputTextBox.Location    = new System.Drawing.Point(startPoint.X, startPoint.Y);
             inputTextBox.Multiline   = true;
             inputTextBox.Name        = "inputTextBox";
             int width = (endPoint.X != startPoint.X) ? (int)Math.Abs(endPoint.X - startPoint.X) : 320;
             inputTextBox.Size = new System.Drawing.Size(
                 width,
                 (int)(TextRenderer.MeasureText("あ", paintTextFont).Height + inputTextBox.Margin.Vertical));
             inputTextBox.TabIndex     = 0;
             inputTextBox.ImeMode      = ImeMode.Off;
             inputTextBox.TextChanged += new EventHandler(inputTextBox_TextChanged);
             ControlsTransparent(inputTextBox, PanelPaint);
             //強制的にフォーカス
             inputTextBox.Focus();
             isPaintingText  = false;
             isInputtingText = true;
         }
         else if (isPaintingFreehand)
         {
             ClsFigure freehand = new ClsFreehand(paintPen, freeHandX, freeHandY);
             figList.Add(freehand);
             reFigList.Clear();
             PanelPaint.Refresh();
             lastFigure = freehand.castClassFigure();
         }
     }
 }