示例#1
0
        private Rectangle DrawNavigationButtons(MNPageContext context, Rectangle textBounds)
        {
            context.g.DrawLine(SMGraphics.GetPen(NormalState.ForeColor, 1), textBounds.Left, textBounds.Bottom,
                               textBounds.Right, textBounds.Bottom);
            if (HasPrevPage())
            {
                prevBtnRect = new Rectangle(textBounds.Left, textBounds.Bottom, textBounds.Width / 2 - 32, navigButtonsHeight);
                if (prevBtnPressed)
                {
                    context.g.FillRectangle(SMGraphics.GetBrush(Color.LightGreen), prevBtnRect);
                }
                context.g.DrawString("< PREV", SMGraphics.GetFontVariation(SystemFonts.MenuFont, 20f), SMGraphics.GetBrush(Color.Gray), prevBtnRect, SMGraphics.StrFormatCenter);
            }
            if (HasNextPage())
            {
                nextBtnRect = new Rectangle(textBounds.Left + textBounds.Width / 2 + 32, textBounds.Bottom, textBounds.Width / 2 - 32, navigButtonsHeight);
                if (nextBtnPressed)
                {
                    context.g.FillRectangle(SMGraphics.GetBrush(Color.LightGreen), nextBtnRect);
                }
                context.g.DrawString("NEXT >", SMGraphics.GetFontVariation(SystemFonts.MenuFont, 20f), SMGraphics.GetBrush(Color.Gray), nextBtnRect, SMGraphics.StrFormatCenter);
            }

            context.g.DrawString(string.Format("{0}/{1}", CurrentPage + 1, PageCount), SMGraphics.GetFontVariation(SystemFonts.MenuFont, 20f),
                                 SMGraphics.GetBrush(Color.Gray), new Rectangle(textBounds.Left + textBounds.Width / 2 - 48, textBounds.Bottom, 96, navigButtonsHeight),
                                 SMGraphics.StrFormatCenter);
            return(textBounds);
        }
示例#2
0
 public override void Paint(MNPageContext context, SMStatusLayout layout, int X, int Y)
 {
     if (Type == SMWordSpecialType.HorizontalLine)
     {
         context.g.DrawLine(SMGraphics.GetPen(layout.ForeColor, 1), rect.X + X, rect.Y + Y + rect.Height / 2, rect.Right + X, rect.Y + Y + rect.Height / 2);
     }
     base.Paint(context, layout, X, Y);
 }
示例#3
0
        private Rectangle DrawColumnSeparators(MNPageContext context, Rectangle textBounds)
        {
            Pen pen = SMGraphics.GetPen(NormalState.ForeColor, 1);

            for (int i = 1; i < Columns; i++)
            {
                int x  = textBounds.Left + i * textBounds.Width / Columns;
                int y  = textBounds.Top;
                int y2 = textBounds.Bottom;
                if (ShowNavigationButtons)
                {
                    y2 -= navigButtonsHeight;
                }

                int cy = y;
                switch (ColumnSeparatorStyle)
                {
                case SMLineStyle.Plain:
                    context.g.DrawLine(pen, x, y, x, y2);
                    break;

                case SMLineStyle.Dashed:
                    while (cy + 16 < y2)
                    {
                        context.g.DrawLine(pen, x, cy, x, cy + 16);
                        cy += 24;
                    }
                    break;

                case SMLineStyle.Doted:
                    while (cy + 3 < y2)
                    {
                        context.g.DrawRectangle(pen, x, cy, 2, 2);
                        cy += 8;
                    }
                    break;

                case SMLineStyle.ZigZag:
                    while (cy + 16 < y2)
                    {
                        context.g.DrawLine(pen, x, cy, x - 4, cy + 4);
                        context.g.DrawLine(pen, x - 4, cy + 4, x + 4, cy + 12);
                        context.g.DrawLine(pen, x + 4, cy + 12, x, cy + 16);
                        cy += 16;
                    }
                    break;
                }
            }
            return(textBounds);
        }
示例#4
0
        public override void Paint(MNPageContext context)
        {
            Rectangle bounds = Area.GetBounds(context);

            Rectangle textBounds = bounds;
            Pen       currentPen;

            // background image is drawn centered
            if (BackgroundImage != null)
            {
                BackgroundImageRect = new Rectangle(textBounds.Location, SMGraphics.GetMaximumSize(textBounds, BackgroundImage.ImageData.Size));
                BackgroundImageRect.Offset((textBounds.Width - BackgroundImageRect.Width) / 2,
                                           (textBounds.Height - BackgroundImageRect.Height) / 2);
                context.g.DrawImage(BackgroundImage.ImageData, BackgroundImageRect);
            }

            /*context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 48, 16, 16);
            *  context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 32, 16, 16);
            *  context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 16, 16, 16);*/
            context.g.DrawRectangle(Pens.Black, textBounds);

            if (!context.drawSelectionMarks)
            {
                foreach (DrawPoints dp in drawPoints)
                {
                    currentPen = SMGraphics.GetPen(dp.penColor, dp.penWidth);
                    context.g.DrawLines(currentPen, dp.pts);
                }

                if (tempPoints.pts.Count > 1)
                {
                    currentPen = SMGraphics.GetPen(tempPoints.penColor, tempPoints.penWidth);
                    context.g.DrawLines(currentPen, tempPoints.pts.ToArray <Point>());
                }
            }

            // draw selection marks
            base.Paint(context);
        }
示例#5
0
        public override void Paint(MNPageContext context, SMStatusLayout layout, int X, int Y)
        {
            string s = GetCurrentText();

            //Brush b = SMGraphics.GetBrush(layout.BackColor);

            if (UIStateHover)
            {
                context.g.DrawRectangle(SMGraphics.GetPen(SMGraphics.dropableLayoutH.BorderColor, 4), rect.X + X, rect.Y + Y, rect.Width, rect.Height);
            }
            else
            {
                context.g.DrawRectangle(SMGraphics.GetPen(SMGraphics.dropableLayoutN.BorderColor, 2), rect.X + X, rect.Y + Y, rect.Width, rect.Height);
            }

            if (Editable && Focused)
            {
                SizeF sz = context.g.MeasureString(editedText, this.Font.Font);
                context.g.FillRectangle(Brushes.LightBlue, rect.X + X + (int)sz.Width, rect.Y + Y + 1, 10, rect.Height - 2);
            }

            context.g.DrawString(s, this.Font.Font, GetCurrentTextBrush(layout), rect.Location.X + X, rect.Location.Y + Y);
        }
示例#6
0
        public override void Paint(MNPageContext context)
        {
            Rectangle bounds = Area.GetBounds(context);

            SMStatusLayout layout = PrepareBrushesAndPens();

            Rectangle textBounds = ContentPadding.ApplyPadding(bounds);

            if (Text.Length == 0)
            {
                bool b = UIStatePressed;
                UIStatePressed |= UIStateChecked;
                DrawStyledBackground(context, layout, textBounds);
                DrawStyledBorder(context, layout, textBounds);
                UIStatePressed = b;
            }
            else
            {
                Font font = GetUsedFont();

                SizeF cbSize = context.g.MeasureString("M", font);
                int   inpad  = (int)(cbSize.Height / 8);
                int   inpad2 = inpad / 2;
                int   height = (int)(cbSize.Height * 3 / 4);


                SizeF sf       = richText.MeasureString(context, Text, textBounds.Width - height - 2 * inpad);
                Size  textSize = new Size((int)sf.Width + 5, (int)sf.Height);

                Pen drawPen = (UIStateError == MNEvaluationResult.Incorrect ? Pens.Red : tempForePen);

                Rectangle rectCB = textBounds;
                if (CheckBoxAtEnd)
                {
                    rectCB          = new Rectangle(textBounds.X + textSize.Width + inpad, rectCB.Top + inpad, height, height);
                    textBounds.Size = textSize;
                }
                else
                {
                    rectCB          = new Rectangle(rectCB.Left + inpad, rectCB.Top + inpad, height, height);
                    textBounds.Size = textSize;
                    textBounds.X   += height + 2 * inpad + ContentPadding.LeftRight;
                }

                if (Status)
                {
                    context.g.DrawFillRoundedRectangle(SMGraphics.GetPen(layout.ForeColor, 1), SMGraphics.GetBrush(layout.BackColor), rectCB, 5);
                }
                else
                {
                    context.g.DrawRoundedRectangle(SMGraphics.GetPen(layout.ForeColor, 1), rectCB, 5);
                }

                if (Clickable)
                {
                    richText.DrawString(context, SMGraphics.clickableLayoutN, Text, textBounds);
                }
                else
                {
                    richText.DrawString(context, NormalState, Text, textBounds);
                }
            }

            // in case this is wrongly checked, run clearing the state in 2 secs
            if (UIStateError == MNEvaluationResult.Incorrect && UIStateChecked)
            {
                if (Document.HasViewer)
                {
                    Document.Viewer.ScheduleCall(MNNotificationCenter.RectifyDelay, this, "clearCheck");
                }
            }


            // draw selection marks
            base.Paint(context, false);
        }