Esempio n. 1
0
        protected override void OnPaint(DCEventArgs e)
        {
            base.OnPaint(e);

            this._画像.描画する(  // null 不可
                e.dc,
                this.ウィンドウ矩形dpx.X,
                this.ウィンドウ矩形dpx.Y,
                転送元矩形: null,
                X方向拡大率: this.拡大率.X,
                Y方向拡大率: this.拡大率.Y);
        }
Esempio n. 2
0
        protected override void OnPaint(DCEventArgs e)
        {
            Debug.Assert(this.活性化している);
            base.OnPaint(e);

            // セル画像を直接画面に描画すると(設計画面から物理画面への変換で)ズレるので、全体画像にセルを全部描画し、それから全体画像を描画する。

            if (this.サイズdpx_枠込み != this.全体画像.サイズ)
            {
                this.全体画像.非活性化する();
                this.子Activityを削除する(this.全体画像);
                this.子Activityを追加する(this.全体画像 = new 描画可能画像(this.サイズdpx_枠込み));
                this.全体画像.活性化する();
            }

            this.全体画像.画像へ描画する((dcw) => {
                dcw.Clear(Color.Transparent);

                // 以下の画像を、以下の順番に、以下の不透明度で描画する。
                var 画像s = new[] {
                    (セル画像: this.通常時セル画像, 透明度: (float)this._通常時セル不透明度.Value),
                    (セル画像: this.押下時セル画像, 透明度: (float)this._押下時セル不透明度.Value),
                    (セル画像: this.フォーカス時セル画像, 透明度: (float)this._フォーカス時セル不透明度.Value),
                };

                for (int i = 0; i < 画像s.Length; i++)
                {
                    if ((null == 画像s[i].セル画像) || (0f == 画像s[i].透明度))
                    {
                        continue;
                    }

                    #region " 中央 "
                    //----------------
                    {
                        var 描画領域 = new RectangleF(
                            this._最大左枠幅dpx,
                            this._最大上枠高さdpx,
                            this.サイズdpx.Width,
                            this.サイズdpx.Height);

                        if ((0f < 描画領域.Width) && (0f < 描画領域.Height))
                        {
                            switch (this.広い部分の描画方法)
                            {
                            case 広い部分の描画方法種別.タイル描画:

                                dcw.PushAxisAlignedClip(描画領域, AntialiasMode.PerPrimitive);

                                for (float x = 描画領域.Left; x < 描画領域.Right; x += this._中央矩形.Width)
                                {
                                    for (float y = 描画領域.Top; y < 描画領域.Bottom; y += this._中央矩形.Height)
                                    {
                                        画像s[i].セル画像.描画する(
                                            dcw,
                                            左位置: x,
                                            位置: y,
                                            転送元矩形: this._中央矩形,
                                            透明度0to1: 画像s[i].透明度,
                                            描画先矩形を整数境界に合わせる: true);
                                    }
                                }

                                dcw.PopAxisAlignedClip();

                                break;

                            case 広い部分の描画方法種別.拡大縮小描画:

                                画像s[i].セル画像.描画する(
                                    dcw,
                                    左位置: 描画領域.Left,
                                    位置: 描画領域.Top,
                                    X方向拡大率: (描画領域.Width / this._中央矩形.Width),
                                    Y方向拡大率: (描画領域.Height / this._中央矩形.Height),
                                    転送元矩形: this._中央矩形,
                                    透明度0to1: 画像s[i].透明度,
                                    描画先矩形を整数境界に合わせる: true);

                                break;
                            }
                        }
                    }
                    //----------------
                    #endregion
                    #region " 左上隅 "
                    //----------------
                    {
                        var 描画位置 = new Vector2(
                            this._最大左枠幅dpx - this._左上矩形.Width,
                            this._最大上枠高さdpx - this._左上矩形.Height);

                        switch (this.広い部分の描画方法)
                        {
                        case 広い部分の描画方法種別.タイル描画:
                        case 広い部分の描画方法種別.拡大縮小描画:
                            画像s[i].セル画像.描画する(
                                dcw,
                                左位置: 描画位置.X,
                                位置: 描画位置.Y,
                                転送元矩形: this._左上矩形,
                                透明度0to1: 画像s[i].透明度,
                                描画先矩形を整数境界に合わせる: true);
                            break;
                        }
                    }
                    //----------------
                    #endregion
                    #region " 上辺 "
                    //----------------
                    {
                        var 描画領域 = new RectangleF(
                            this._最大左枠幅dpx,
                            this._最大上枠高さdpx - this._上辺矩形.Height,
                            this.サイズdpx.Width,
                            this._上辺矩形.Height);

                        if ((0f < 描画領域.Width) && (0f < 描画領域.Height))
                        {
                            switch (this.広い部分の描画方法)
                            {
                            case 広い部分の描画方法種別.タイル描画:

                                dcw.PushAxisAlignedClip(描画領域, AntialiasMode.PerPrimitive);

                                for (float x = 描画領域.Left; x < 描画領域.Right; x += this._上辺矩形.Width)
                                {
                                    画像s[i].セル画像.描画する(
                                        dcw,
                                        左位置: x,
                                        位置: 描画領域.Y,
                                        転送元矩形: this._上辺矩形,
                                        透明度0to1: 画像s[i].透明度,
                                        描画先矩形を整数境界に合わせる: true);
                                }

                                dcw.PopAxisAlignedClip();

                                break;

                            case 広い部分の描画方法種別.拡大縮小描画:

                                画像s[i].セル画像.描画する(
                                    dcw,
                                    左位置: 描画領域.Left,
                                    位置: 描画領域.Top,
                                    X方向拡大率: (描画領域.Width / this._上辺矩形.Width),
                                    Y方向拡大率: (描画領域.Height / this._上辺矩形.Height),
                                    転送元矩形: this._上辺矩形,
                                    透明度0to1: 画像s[i].透明度,
                                    描画先矩形を整数境界に合わせる: true);

                                break;
                            }
                        }
                    }
                    //----------------
                    #endregion
                    #region " 右上隅 "
                    //----------------
                    {
                        var 描画位置 = new Vector2(
                            this.全体画像.サイズ.Width - this._最大右枠幅dpx,
                            this._最大上枠高さdpx - this._右上矩形.Height);

                        switch (this.広い部分の描画方法)
                        {
                        case 広い部分の描画方法種別.タイル描画:
                        case 広い部分の描画方法種別.拡大縮小描画:
                            画像s[i].セル画像.描画する(
                                dcw,
                                左位置: 描画位置.X,
                                位置: 描画位置.Y,
                                転送元矩形: this._右上矩形,
                                透明度0to1: 画像s[i].透明度,
                                描画先矩形を整数境界に合わせる: true);
                            break;
                        }
                    }
                    //----------------
                    #endregion
                    #region " 左下隅 "
                    //----------------
                    {
                        var 描画位置 = new Vector2(
                            this._最大左枠幅dpx - this._左下矩形.Width,
                            this.全体画像.サイズ.Height - this._最大下枠高さdpx);

                        switch (this.広い部分の描画方法)
                        {
                        case 広い部分の描画方法種別.タイル描画:
                        case 広い部分の描画方法種別.拡大縮小描画:
                            画像s[i].セル画像.描画する(
                                dcw,
                                左位置: 描画位置.X,
                                位置: 描画位置.Y,
                                転送元矩形: this._左下矩形,
                                透明度0to1: 画像s[i].透明度,
                                描画先矩形を整数境界に合わせる: true);
                            break;
                        }
                    }
                    //----------------
                    #endregion
                    #region " 下辺 "
                    //----------------
                    {
                        var 描画領域 = new RectangleF(
                            this._最大左枠幅dpx,
                            this.全体画像.サイズ.Height - this._最大下枠高さdpx,
                            this.サイズdpx.Width,
                            this._下辺矩形.Height);

                        if ((0f < 描画領域.Width) && (0f < 描画領域.Height))
                        {
                            switch (this.広い部分の描画方法)
                            {
                            case 広い部分の描画方法種別.タイル描画:

                                dcw.PushAxisAlignedClip(描画領域, AntialiasMode.PerPrimitive);

                                for (float x = 描画領域.Left; x < 描画領域.Right; x += this._上辺矩形.Width)
                                {
                                    画像s[i].セル画像.描画する(
                                        dcw,
                                        左位置: x,
                                        位置: 描画領域.Y,
                                        転送元矩形: this._下辺矩形,
                                        透明度0to1: 画像s[i].透明度,
                                        描画先矩形を整数境界に合わせる: true);
                                }

                                dcw.PopAxisAlignedClip();

                                break;

                            case 広い部分の描画方法種別.拡大縮小描画:

                                画像s[i].セル画像.描画する(
                                    dcw,
                                    左位置: 描画領域.Left,
                                    位置: 描画領域.Top,
                                    X方向拡大率: (描画領域.Width / this._下辺矩形.Width),
                                    Y方向拡大率: (描画領域.Height / this._下辺矩形.Height),
                                    転送元矩形: this._下辺矩形,
                                    透明度0to1: 画像s[i].透明度,
                                    描画先矩形を整数境界に合わせる: true);

                                break;
                            }
                        }
                    }
                    //----------------
                    #endregion
                    #region " 右下隅 "
                    //----------------
                    {
                        var 描画位置 = new Vector2(
                            this.全体画像.サイズ.Width - this._最大右枠幅dpx,
                            this.全体画像.サイズ.Height - this._最大下枠高さdpx);

                        switch (this.広い部分の描画方法)
                        {
                        case 広い部分の描画方法種別.タイル描画:
                        case 広い部分の描画方法種別.拡大縮小描画:
                            画像s[i].セル画像.描画する(
                                dcw,
                                左位置: 描画位置.X,
                                位置: 描画位置.Y,
                                転送元矩形: this._右下矩形,
                                透明度0to1: 画像s[i].透明度,
                                描画先矩形を整数境界に合わせる: true);
                            break;
                        }
                    }
                    //----------------
                    #endregion
                    #region " 左辺 "
                    //----------------
                    {
                        var 描画領域 = new RectangleF(
                            this._最大左枠幅dpx - this._左辺矩形.Width,
                            this._最大上枠高さdpx,
                            this._左辺矩形.Width,
                            this.サイズdpx.Height);

                        if ((0f < 描画領域.Width) && (0f < 描画領域.Height))
                        {
                            switch (this.広い部分の描画方法)
                            {
                            case 広い部分の描画方法種別.タイル描画:

                                dcw.PushAxisAlignedClip(描画領域, AntialiasMode.PerPrimitive);

                                for (float y = 描画領域.Top; y < 描画領域.Bottom; y += this._左辺矩形.Height)
                                {
                                    画像s[i].セル画像.描画する(
                                        dcw,
                                        左位置: 描画領域.X,
                                        位置: y,
                                        転送元矩形: this._左辺矩形,
                                        透明度0to1: 画像s[i].透明度,
                                        描画先矩形を整数境界に合わせる: true);
                                }

                                dcw.PopAxisAlignedClip();

                                break;

                            case 広い部分の描画方法種別.拡大縮小描画:

                                画像s[i].セル画像.描画する(
                                    dcw,
                                    左位置: 描画領域.Left,
                                    位置: 描画領域.Top,
                                    X方向拡大率: (描画領域.Width / this._左辺矩形.Width),
                                    Y方向拡大率: (描画領域.Height / this._左辺矩形.Height),
                                    転送元矩形: this._左辺矩形,
                                    透明度0to1: 画像s[i].透明度,
                                    描画先矩形を整数境界に合わせる: true);

                                break;
                            }
                        }
                    }
                    //----------------
                    #endregion
                    #region " 右辺 "
                    //----------------
                    {
                        var 描画領域 = new RectangleF(
                            this.全体画像.サイズ.Width - this._最大右枠幅dpx,
                            this._最大上枠高さdpx,
                            this._右辺矩形.Width,
                            this.サイズdpx.Height);

                        if ((0f < 描画領域.Width) && (0f < 描画領域.Height))
                        {
                            switch (this.広い部分の描画方法)
                            {
                            case 広い部分の描画方法種別.タイル描画:

                                dcw.PushAxisAlignedClip(描画領域, AntialiasMode.PerPrimitive);

                                for (float y = 描画領域.Top; y < 描画領域.Bottom; y += this._右辺矩形.Height)
                                {
                                    画像s[i].セル画像.描画する(
                                        dcw,
                                        左位置: 描画領域.X,
                                        位置: y,
                                        転送元矩形: this._右辺矩形,
                                        透明度0to1: 画像s[i].透明度,
                                        描画先矩形を整数境界に合わせる: true);
                                }

                                dcw.PopAxisAlignedClip();

                                break;

                            case 広い部分の描画方法種別.拡大縮小描画:

                                画像s[i].セル画像.描画する(
                                    dcw,
                                    左位置: 描画領域.Left,
                                    位置: 描画領域.Top,
                                    X方向拡大率: (描画領域.Width / this._右辺矩形.Width),
                                    Y方向拡大率: (描画領域.Height / this._右辺矩形.Height),
                                    転送元矩形: this._右辺矩形,
                                    透明度0to1: 画像s[i].透明度,
                                    描画先矩形を整数境界に合わせる: true);

                                break;
                            }
                        }
                    }
                    //----------------
                    #endregion
                }
            });
Esempio n. 3
0
        protected override void OnPaint(DCEventArgs e)
        {
            base.OnPaint(e);

            this._ボタンラベル.テキスト = this.ラベル;
        }