Ejemplo n.º 1
0
        //────────────────────────────────────────

        /// <summary>
        /// この関数は、Function2_LoadCsvに渡されます。
        /// </summary>
        /// <param name="mNum"></param>
        /// <param name="scale2"></param>
        public void UsercontrolCanvas_OnChangeSpritePartsnumber(Memory4bSpritePartsnumber mNum, float scale2)
        {
            if (this.Owner_MemoryApplication.IsDisplayExecute && mNum.IsDefinitionExpression)
            {
                // 数値表示モードでは、名前定義は表示しません。
                mNum.Scale = 1.0f;
                mNum.BoundsCircleScaledOnBackground = new Rectangle();
                mNum.BoundsTextScaledOnBackground   = new Rectangle();
                goto gt_EndMethod;
            }

            mNum.Scale = scale2;
            float x = scale2 * mNum.LocationOnBackgroundActual.X;
            float y = scale2 * mNum.LocationOnBackgroundActual.Y;

            // ドット絵の1ドットを最小単位にして動くよう調整。スケールは 1、または 2の倍数の整数。
            x = (float)((int)(x / scale2) * (int)scale2);
            y = (float)((int)(y / scale2) * (int)scale2);


            // 番号スプライトのサイズ
            string   sText = mNum.GetText(true, this.Owner_MemoryApplication);
            Graphics g     = this.CreateGraphics();
            SizeF    sizeF = g.MeasureString(sText, mNum.Font);

            g.Dispose();


            // センタリング
            x -= sizeF.Width / 2;
            y -= sizeF.Height / 2;

            // 後ろに、少し大きめの丸を塗ります。
            mNum.BoundsCircleScaledOnBackground = new Rectangle(
                (int)x - 4,
                (int)y - 4,
                (int)sizeF.Width + 8,
                (int)sizeF.Height + 2
                );
            mNum.BoundsTextScaledOnBackground = new Rectangle(
                (int)x,
                (int)y,
                (int)(scale2 * sizeF.Width),
                (int)(scale2 * sizeF.Height)
                );

            goto gt_EndMethod;
            //
            //
            //
            //
gt_EndMethod:
            mNum.IsDirty = false;
        }
Ejemplo n.º 2
0
        //────────────────────────────────────────
        /// <summary>
        /// この関数は、Function2_LoadCsvに渡されます。
        /// </summary>
        /// <param name="mNum"></param>
        /// <param name="scale2"></param>
        public void UsercontrolCanvas_OnChangeSpritePartsnumber(Memory4bSpritePartsnumber mNum, float scale2)
        {
            if (this.Owner_MemoryApplication.IsDisplayExecute && mNum.IsDefinitionExpression)
            {
                // 数値表示モードでは、名前定義は表示しません。
                mNum.Scale = 1.0f;
                mNum.BoundsCircleScaledOnBackground = new Rectangle();
                mNum.BoundsTextScaledOnBackground = new Rectangle();
                goto gt_EndMethod;
            }

            mNum.Scale = scale2;
            float x = scale2 * mNum.LocationOnBackgroundActual.X;
            float y = scale2 * mNum.LocationOnBackgroundActual.Y;

            // ドット絵の1ドットを最小単位にして動くよう調整。スケールは 1、または 2の倍数の整数。
            x = (float)((int)(x / scale2) * (int)scale2);
            y = (float)((int)(y / scale2) * (int)scale2);

            // 番号スプライトのサイズ
            string sText = mNum.GetText( true, this.Owner_MemoryApplication);
            Graphics g = this.CreateGraphics();
            SizeF sizeF = g.MeasureString(sText, mNum.Font);
            g.Dispose();

            // センタリング
            x -= sizeF.Width / 2;
            y -= sizeF.Height / 2;

            // 後ろに、少し大きめの丸を塗ります。
            mNum.BoundsCircleScaledOnBackground = new Rectangle(
                (int)x - 4,
                (int)y - 4,
                (int)sizeF.Width + 8,
                (int)sizeF.Height + 2
                );
            mNum.BoundsTextScaledOnBackground = new Rectangle(
                (int)x,
                (int)y,
                (int)(scale2 * sizeF.Width),
                (int)(scale2 * sizeF.Height)
                );

            goto gt_EndMethod;
            //
            //
            //
            //
            gt_EndMethod:
            mNum.IsDirty = false;
        }
Ejemplo n.º 3
0
        //────────────────────────────────────────

        public void PaintSprite(
            Graphics g, Memory4bSpritePartsnumber memSprNum, bool isOnWindow, float scale2)
        {
            if (this.IsDisplayExecute && memSprNum.IsDefinitionExpression)
            {
                // 数値表示モードでは、名前定義は表示しません。
                goto process_end;
            }

            if (memSprNum.IsDirty || memSprNum.Scale != scale2)
            {
                memSprNum.Delegate_OnChangeSprite_Partsnumber(memSprNum, scale2);//, numPutUc
            }

            Rectangle boundsCircle;

            if (isOnWindow)
            {
                boundsCircle = new Rectangle(
                    memSprNum.BoundsCircleScaledOnBackground.X + (int)this.BgLocationScaled.X,
                    memSprNum.BoundsCircleScaledOnBackground.Y + (int)this.BgLocationScaled.Y,
                    memSprNum.BoundsCircleScaledOnBackground.Width,
                    memSprNum.BoundsCircleScaledOnBackground.Height
                    );
            }
            else
            {
                boundsCircle = memSprNum.BoundsCircleScaledOnBackground;
            }

            Rectangle boundsText;

            if (isOnWindow)
            {
                boundsText = new Rectangle(
                    memSprNum.BoundsTextScaledOnBackground.X + (int)this.BgLocationScaled.X,
                    memSprNum.BoundsTextScaledOnBackground.Y + (int)this.BgLocationScaled.Y,
                    memSprNum.BoundsTextScaledOnBackground.Width,
                    memSprNum.BoundsTextScaledOnBackground.Height
                    );
            }
            else
            {
                boundsText = new Rectangle(
                    memSprNum.BoundsTextScaledOnBackground.X,
                    memSprNum.BoundsTextScaledOnBackground.Y,
                    memSprNum.BoundsTextScaledOnBackground.Width,
                    memSprNum.BoundsTextScaledOnBackground.Height
                    );
            }


            //// 番号スプライトのサイズ
            string sText = memSprNum.GetText(true, this);

            // 後ろに、少し大きめの丸を塗ります。
            Brush backBrush;

            if (memSprNum.IsMouseTarget)
            {
                backBrush = Brushes.YellowGreen;
            }
            else
            {
                backBrush = memSprNum.BrushBackground;
            }
            g.FillEllipse(backBrush, boundsCircle.X, boundsCircle.Y, boundsCircle.Width, boundsCircle.Height);
            g.DrawEllipse(memSprNum.PenForeground, boundsCircle.X, boundsCircle.Y, boundsCircle.Width, boundsCircle.Height);


            // 影
            g.DrawString(
                sText,
                memSprNum.Font,
                Brushes.Black,
                boundsText.Location
                );
            boundsText.Offset(-1, -1);
            // 文字
            g.DrawString(
                sText,
                memSprNum.Font,
                Brushes.White,
                boundsText.Location
                );

            goto process_end;
            //
            //
            //
            //
process_end:
            ;
        }
        //────────────────────────────────────────
        public void PaintSprite(
            Graphics g, Memory4bSpritePartsnumber memSprNum, bool isOnWindow, float scale2)
        {
            if (this.IsDisplayExecute && memSprNum.IsDefinitionExpression)
            {
                // 数値表示モードでは、名前定義は表示しません。
                goto process_end;
            }

            if (memSprNum.IsDirty || memSprNum.Scale != scale2)
            {
                memSprNum.Delegate_OnChangeSprite_Partsnumber(memSprNum, scale2);//, numPutUc
            }

            Rectangle boundsCircle;
            if (isOnWindow)
            {
                boundsCircle = new Rectangle(
                        memSprNum.BoundsCircleScaledOnBackground.X + (int)this.BgLocationScaled.X,
                        memSprNum.BoundsCircleScaledOnBackground.Y + (int)this.BgLocationScaled.Y,
                        memSprNum.BoundsCircleScaledOnBackground.Width,
                        memSprNum.BoundsCircleScaledOnBackground.Height
                        );
            }
            else
            {
                boundsCircle = memSprNum.BoundsCircleScaledOnBackground;
            }

            Rectangle boundsText;
            if (isOnWindow)
            {
                boundsText = new Rectangle(
                        memSprNum.BoundsTextScaledOnBackground.X + (int)this.BgLocationScaled.X,
                        memSprNum.BoundsTextScaledOnBackground.Y + (int)this.BgLocationScaled.Y,
                        memSprNum.BoundsTextScaledOnBackground.Width,
                        memSprNum.BoundsTextScaledOnBackground.Height
                    );
            }
            else
            {
                boundsText = new Rectangle(
                    memSprNum.BoundsTextScaledOnBackground.X,
                    memSprNum.BoundsTextScaledOnBackground.Y,
                    memSprNum.BoundsTextScaledOnBackground.Width,
                    memSprNum.BoundsTextScaledOnBackground.Height
                    );
            }

            //// 番号スプライトのサイズ
            string sText = memSprNum.GetText(true, this);

            // 後ろに、少し大きめの丸を塗ります。
            Brush backBrush;
            if (memSprNum.IsMouseTarget)
            {
                backBrush = Brushes.YellowGreen;
            }
            else
            {
                backBrush = memSprNum.BrushBackground;
            }
            g.FillEllipse(backBrush, boundsCircle.X, boundsCircle.Y, boundsCircle.Width, boundsCircle.Height);
            g.DrawEllipse(memSprNum.PenForeground, boundsCircle.X, boundsCircle.Y, boundsCircle.Width, boundsCircle.Height);

            // 影
            g.DrawString(
                sText,
                memSprNum.Font,
                Brushes.Black,
                boundsText.Location
                );
            boundsText.Offset(-1, -1);
            // 文字
            g.DrawString(
                sText,
                memSprNum.Font,
                Brushes.White,
                boundsText.Location
                );

            goto process_end;
            //
            //
            //
            //
            process_end:
            ;
        }