Beispiel #1
0
        //=================================================================
        // Bound X/Y/Width/Height
        //=================================================================

        /// BoundX表示用
        /// @param layoutElement データ取得元のレイアウト要素
        /// @param isDummy ダミープレビューサイズかどうか
        /// @param sampleWidth サンプルの幅
        /// @param sampleHeight サンプルの高さ
        /// @param[out] x BoundXの文字列
        /// @param[out] y BoundYの文字列
        /// @param[out] width BoundWidthの文字列
        /// @param[out] height BoundHeightの文字列
        /// @return BoundX表示用文字列
        public static void GetBoundRectString(LayoutElement layoutElement,
                                              bool isDummy, int sampleWidth, int sampleHeight,
                                              out string x, out string y, out string width, out string height)
        {
            var boundRect = layoutElement.GetBoundRect(sampleWidth, sampleHeight);

            x = isDummy ? string.Format("({0})", boundRect.X)
                : boundRect.X.ToString();
            y = isDummy ? string.Format("({0})", boundRect.Y)
                : boundRect.Y.ToString();
            width = isDummy ? string.Format("({0})", boundRect.Width)
                    : boundRect.Width.ToString();
            height = isDummy ? string.Format("({0})", boundRect.Height)
                     : boundRect.Height.ToString();
        }
        //=================================================================
        // Bound X/Y/Width/Height
        //=================================================================
        /// BoundX表示用
        /// @param layoutElement データ取得元のレイアウト要素
        /// @param isDummy ダミープレビューサイズかどうか
        /// @param sampleWidth サンプルの幅
        /// @param sampleHeight サンプルの高さ
        /// @param[out] x BoundXの文字列
        /// @param[out] y BoundYの文字列
        /// @param[out] width BoundWidthの文字列
        /// @param[out] height BoundHeightの文字列
        /// @return BoundX表示用文字列
        public static void GetBoundRectString(LayoutElement layoutElement,
            bool isDummy, int sampleWidth, int sampleHeight,
            out string x, out string y, out string width, out string height)
        {
            var boundRect = layoutElement.GetBoundRect(sampleWidth, sampleHeight);

            x = isDummy ? string.Format("({0})", boundRect.X)
                : boundRect.X.ToString();
            y = isDummy ? string.Format("({0})", boundRect.Y)
                : boundRect.Y.ToString();
            width = isDummy ? string.Format("({0})", boundRect.Width)
                    : boundRect.Width.ToString();
            height = isDummy ? string.Format("({0})", boundRect.Height)
                     : boundRect.Height.ToString();
        }
Beispiel #3
0
 /// LayoutEdit用ヘッダー文字列
 /// @param layoutElement データ取得元のレイアウト要素
 /// @param index レイアウト要素のインデックス
 /// @param isCurrent 現在選択中のLayoutElementか
 /// @param isDummy ダミープレビューサイズかどうか
 /// @param sampleWidth サンプルの幅
 /// @param sampleHeight サンプルの高さ
 /// @return LayoutEdit用ヘッダー文字列
 public static string GetHeaderStringForLayoutEdit(
     LayoutElement layoutElement, int index,
     bool isCurrent, bool isDummy, int sampleWidth, int sampleHeight)
 {
     if (isCurrent && isDummy)
     {
         return(string.Format(" [{0}] {1}", index + 1, layoutElement.WindowCaption));
     }
     else if (isCurrent)
     {
         var boundRect = layoutElement.GetBoundRect(sampleWidth, sampleHeight);
         return(string.Format(" [{0}] ({1}x{2}) {3}",
                              index + 1,
                              boundRect.Width,
                              boundRect.Height,
                              layoutElement.WindowCaption));
     }
     else
     {
         return(string.Format(" [{0}]", index + 1));
     }
 }
 /// プレビュー画像の描画
 /// @param dc 描画先
 /// @param layoutElement 描画対象
 private void DrawPreview(DrawingContext dc, LayoutElement layoutElement)
 {
     var bitmap = App.ScreenCaptureTimer.GetBitmapSource(layoutElement);
     if (bitmap == null) {
       // エラーが起きた場合は赤色の四角形を描画
       var boundRect = layoutElement.GetBoundRect(
       App.RuntimeOptions.CurrentSampleWidth,
       App.RuntimeOptions.CurrentSampleHeight).ToRect();
       dc.DrawRectangle(Brushes.Red, null, boundRect);
     } else {
       // プレビューの描画
       var actualBoundRect = layoutElement.GetActualBoundRect(
       App.RuntimeOptions.CurrentSampleWidth,
       App.RuntimeOptions.CurrentSampleHeight).ToRect();
       dc.DrawImage(bitmap, actualBoundRect);
     }
 }
        /// 枠線とキャプションの描画
        /// @param dc 描画先
        /// @param layoutElement 描画対象
        /// @param index 描画対象のインデックス
        private void DrawBorder(DrawingContext dc, LayoutElement layoutElement, int index)
        {
            // フレームサイズ
            var boundRect = layoutElement.GetBoundRect(
            App.RuntimeOptions.CurrentSampleWidth,
            App.RuntimeOptions.CurrentSampleHeight).ToRect();

            // スタイルの取得
            Brush textBrush;
            Pen framePen;
            this.CreateBorderStyle(layoutElement, out framePen, out textBrush);

            // フレームの描画
            var inflateValue = framePen.Thickness / 2;
            var infraleRect = Rect.Inflate(boundRect, -inflateValue, -inflateValue);
            dc.DrawRectangle(null, framePen, infraleRect);

            // ヘッダーのドロップシャドウの描画
            var shadowOffset = 1.0;
            var shadowPoint = new Point(boundRect.X + shadowOffset, boundRect.Y + shadowOffset);
            var shadowBoundRect = new Rect(boundRect.X + shadowOffset,
                                   boundRect.Y + shadowOffset,
                                   boundRect.Width - shadowOffset,
                                   boundRect.Height - shadowOffset);
            var shadow = this.CreateHeader(layoutElement, index, shadowBoundRect, BrushesAndPens.DropShadowBrush);
            dc.DrawText(shadow, shadowPoint);

            // ヘッダーの描画
            var headerPoint = new Point(boundRect.X, boundRect.Y);
            var header = this.CreateHeader(layoutElement, index, boundRect, textBrush);
            dc.DrawText(header, headerPoint);
        }
 /// LayoutEdit用ヘッダー文字列
 /// @param layoutElement データ取得元のレイアウト要素
 /// @param index レイアウト要素のインデックス
 /// @param isCurrent 現在選択中のLayoutElementか
 /// @param isDummy ダミープレビューサイズかどうか
 /// @param sampleWidth サンプルの幅
 /// @param sampleHeight サンプルの高さ
 /// @return LayoutEdit用ヘッダー文字列
 public static string GetHeaderStringForLayoutEdit(
     LayoutElement layoutElement, int index,
     bool isCurrent, bool isDummy, int sampleWidth, int sampleHeight)
 {
     if (isCurrent && isDummy) {
       return string.Format(" [{0}] {1}", index + 1, layoutElement.WindowCaption);
     } else if (isCurrent) {
       var boundRect = layoutElement.GetBoundRect(sampleWidth, sampleHeight);
       return string.Format(" [{0}] ({1}x{2}) {3}",
       index + 1,
       boundRect.Width,
       boundRect.Height,
       layoutElement.WindowCaption);
     } else {
       return string.Format(" [{0}]", index + 1);
     }
 }