Esempio n. 1
0
        //public ConsoleButtonString GetPointingButton(int pointX)
        //{
        //	////1815 優先順位を逆順にする
        //	////後から描画されるボタンが優先されるように
        //	for (int i = 0; i < buttons.Length; i++)
        //	{
        //		ConsoleButtonString button = buttons[buttons.Length - i - 1];
        //		if ((button.PointX <= pointX) && (button.PointX + button.Width >= pointX))
        //			return button;
        //	}
        //	//foreach (ConsoleButtonString button in buttons)
        //	//{
        //	//    if ((button.PointX <= pointX) && (button.PointX + button.Width >= pointX))
        //	//        return button;
        //	//}
        //	return null;
        //}

        public void DrawTo(Graphics graph, int pointY, bool isBackLog, bool force, TextDrawingMode mode)
        {
            foreach (ConsoleButtonString button in buttons)
            {
                button.DrawTo(graph, pointY, isBackLog, mode);
            }
        }
Esempio n. 2
0
 public StringMeasure(Graphics g, Color bgColor, TextDrawingMode textDrawingMode)
 {
     mode = textDrawingMode;
     if (mode == TextDrawingMode.WINAPI)
         GDI.GDIStart(g, bgColor);
     graph = g;
 }
Esempio n. 3
0
 public static int GetDisplayLength(Graphics g, string s, Font font, TextDrawingMode textDrawingMode)
 {
     if (string.IsNullOrEmpty(s))
         return 0;
     if (textDrawingMode == TextDrawingMode.GRAPHICS)
     {
         if (s.Contains("\t"))
             s = s.Replace("\t", "        ");
         ranges[0].Length = s.Length;
         //CharacterRange[] ranges = new CharacterRange[] { new CharacterRange(0, s.Length) };
         sf.SetMeasurableCharacterRanges(ranges);
         Region[] regions = g.MeasureCharacterRanges(s, font, layoutRect, sf);
         RectangleF rectF = regions[0].GetBounds(g);
         //return (int)rectF.Width;//プロポーショナルでなくても数ピクセルずれる
         return (int)((int)((rectF.Width - 1) / fontDisplaySize + 0.95f) * fontDisplaySize);
     }
     else if (textDrawingMode == TextDrawingMode.TEXTRENDERER)
     {
         Size size = TextRenderer.MeasureText(g, s, font, layoutSize, TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix);
         //Size size = TextRenderer.MeasureText(g, s, StaticConfig.Font);
         return size.Width;
     }
     else// if (StaticConfig.TextDrawingMode == TextDrawingMode.WINAPI)
     {
         Size size = GDI.MeasureText(s, font);
         return size.Width;
     }
     //来るわけがない
     //else
     //    throw new ExeEE("描画モード不明");
 }
Esempio n. 4
0
        public void DrawTo(Graphics graph, int pointY, bool isBackLog, TextDrawingMode mode)
        {
            bool isSelecting = (IsButton) && (parent.ButtonIsSelected(this));

            foreach (AConsoleDisplayPart css in strArray)
            {
                css.DrawTo(graph, pointY, isSelecting, isBackLog, mode);
            }
        }
Esempio n. 5
0
        public void DrawTo(Graphics graph, int pointY, bool isBackLog, TextDrawingMode mode)
        {
            bool isSelecting = (IsButton) && (parent.ButtonIsSelected(this));

            for (var i = 0; i < strArray.Length; ++i)
            {
                strArray[i].DrawTo(graph, pointY, isSelecting, isBackLog, mode);
            }
        }
Esempio n. 6
0
        public void DrawTo(Graphics graph, int pointY, bool isBackLog, TextDrawingMode mode)
        {
            var isSelecting = IsButton && parent.ButtonIsSelected(this);

            foreach (var css in StrArray)
            {
                css.DrawTo(graph, pointY, isSelecting, isBackLog, mode);
            }
        }
Esempio n. 7
0
 public StringMeasure()
 {
     textDrawingMode = Config.TextDrawingMode;
     layoutSize      = new Size(Config.WindowX * 2, Config.LineHeight);
     layoutRect      = new RectangleF(0, 0, Config.WindowX * 2, Config.LineHeight);
     fontDisplaySize = Config.Font.Size / 2 * 1.04f; //実際には指定したフォントより若干幅をとる?
     //bmp = new Bitmap(Config.WindowX, Config.LineHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     bmp   = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
     graph = Graphics.FromImage(bmp);
     if (textDrawingMode == TextDrawingMode.WINAPI)
     {
         GDI.GdiMesureTextStart(graph);
     }
 }
Esempio n. 8
0
        public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (this.Error)
            {
                return;
            }
            ASprite img = cImage;

            if (isSelecting && cImageB != null)
            {
                img = cImageB;
            }

            if (img != null && img.IsCreated)
            {
                Rectangle rect = destRect;
                //PointX微調整
                rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
                rect.Y = destRect.Y + pointY;
                if (!img.Position.IsEmpty)
                {
                    rect.X = rect.X + img.Position.X * rect.Width / img.Rectangle.Width;
                    rect.Y = rect.Y + img.Position.Y * rect.Height / img.Rectangle.Height;
                }
                graph.DrawImage(img.Bitmap, rect, img.Rectangle, GraphicsUnit.Pixel);
            }
            else
            {
                if (mode == TextDrawingMode.GRAPHICS)
                {
                    graph.DrawString(AltText, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
                }
                else
                {
                    System.Windows.Forms.TextRenderer.DrawText(graph, AltText, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
                }
            }
        }
 public void DrawTo(Graphics graph, int pointY, bool isBackLog, bool force, TextDrawingMode mode)
 {
     foreach (ConsoleButtonString button in buttons)
         button.DrawTo(graph, pointY, isBackLog, mode);
 }
Esempio n. 10
0
 public abstract void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode);
Esempio n. 11
0
 public override void DrawTo(System.Drawing.Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
 {
     if (mode == TextDrawingMode.GRAPHICS)
     {
         graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
     }
     else
     {
         System.Windows.Forms.TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
     }
 }
Esempio n. 12
0
 public override void DrawTo(System.Drawing.Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
 {
 }
Esempio n. 13
0
		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
		{
			//if (this.Error)
			//	return;
			//ASprite img = cImage;
			//if (isSelecting && cImageB != null)
			//	img = cImageB;
            //
			//if (img != null && img.IsCreated)
			//{
			//	Rectangle rect = destRect;
			//	//PointX微調整
			//	rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
			//	rect.Y = destRect.Y + pointY;
			//	img.GraphicsDraw(graph, rect);
			//}
			//else
			//{
			//	if (mode == TextDrawingMode.GRAPHICS)
			//		graph.DrawString(AltText, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
			//	else
			//		System.Windows.Forms.TextRenderer.DrawText(graph, AltText, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
			//}
		}
Esempio n. 14
0
 public void DrawTo(Graphics graph, int pointY, bool isBackLog, TextDrawingMode mode)
 {
     bool isSelecting = (IsButton) && (parent.ButtonIsSelected(this));
     foreach (ConsoleStyledString css in strArray)
         css.DrawTo(graph, pointY, isSelecting, isBackLog, mode);
 }
Esempio n. 15
0
        public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (this.Error)
            {
                return;
            }
            CroppedImage img = cImage;

            if (isSelecting && cImageB != null)
            {
                img = cImageB;
            }
            Rectangle rect = destRect;

            //PointX微調整
            rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
            rect.Y = destRect.Y + pointY;

            if (img != null)
            {
                if (ia == null)
                {
                    graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle, GraphicsUnit.Pixel);
                }
                else
                {
                    graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle.X, img.Rectangle.Y, img.Rectangle.Width, img.Rectangle.Height, GraphicsUnit.Pixel, ia);
                }
            }
            else
            {
                if (mode == TextDrawingMode.GRAPHICS)
                {
                    graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
                }
                else
                {
                    System.Windows.Forms.TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
                }
            }
        }
Esempio n. 16
0
        public override void DrawTo(System.Drawing.Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (!visible)
            {
                return;
            }
            Rectangle targetRect = rect;

            targetRect.X = targetRect.X + PointX;
            targetRect.Y = targetRect.Y + pointY;
            Color dcolor = isSelecting ? ButtonColor : Color;

            graph.FillRectangle(new SolidBrush(dcolor), targetRect);
        }
Esempio n. 17
0
        public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (Error)
            {
                return;
            }
            var color = Color;

            if (isSelecting)
            {
                color = ButtonColor;
            }
            else if (isBackLog && !colorChanged)
            {
                color = Config.LogColor;
            }

            if (mode == TextDrawingMode.GRAPHICS)
            {
                graph.DrawString(Str, Font, new SolidBrush(color), new Point(PointX, pointY));
            }
            else
            {
                TextRenderer.DrawText(graph, Str, Font, new Point(PointX, pointY), color, TextFormatFlags.NoPrefix);
            }
        }
Esempio n. 18
0
        public void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            Color color = this.Color;
            if(isSelecting)
                color = Config.FocusColor;
            else if (isBackLog && !colorChanged)
                color = Config.LogColor;

            if (mode == TextDrawingMode.GRAPHICS)
                graph.DrawString(Str, Font, new SolidBrush(color), new Point(PointX, pointY));
            else
                TextRenderer.DrawText(graph, Str, Font, new Point(PointX, pointY), color, TextFormatFlags.NoPrefix);
        }