コード例 #1
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            VectorGraphics.DrawSquareBracket(new RectangleF(Left + 3, Top, Width - 6, Height), g, Brushes.Black);

            SizeF bracketSize   = g.MeasureString("[", font);
            SizeF separatorSize = g.MeasureString(",", font);


            float baseLine = Top + Height - maxBottom;

            float x = Left + bracketSize.Width;


            int index = 0;

            foreach (Expression item in Items)
            {
                item.Draw(g, font, style);

                x += item.DesiredWidth;

                if (index < Items.Length - 1)
                {
                    g.DrawString(",", font, Brushes.Black, x, baseLine - separatorSize.Height / 2);
                    x += separatorSize.Width;
                }


                index++;
            }
        }
コード例 #2
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            VectorGraphics.DrawSquareBracket(new RectangleF(Left, Top, Width, Height), g, Brushes.Black);

            Pen p = new Pen(Brushes.LightGray);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            int rowCount    = Rows.Length;
            int columnCount = Rows[0].Length;

            float spacing = 10;

            float y = Top + spacing;

            for (int row = 0; row <= rowCount - 1; row++)
            {
                float x = Left + spacing;

                for (int column = 0; column <= columnCount - 1; column++)
                {
                    Expression item = Rows[row][column];
                    item.Draw(g, font, style);

                    g.DrawRectangle(p, x, y, maxCellWidth[column], maxCellTopHeight[row] + maxCellBottomHeight[row]);

                    x += maxCellWidth[column] + spacing;
                }

                y += maxCellTopHeight[row] + maxCellBottomHeight[row] + spacing;
            }

            p.Dispose();
        }
コード例 #3
0
ファイル: SumExpression.cs プロジェクト: CodingWasaby/Mathy
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            float left = Left;
            float y    = Top + GetSigmaTop();

            Operand.Draw(g, font, style);

            foreach (SigmaConfig sigma in Sigmas)
            {
                float sectionWidth = sigma.From == null ? SigmaWidth : Math.Max(SigmaWidth, Math.Max(sigma.From.DesiredWidth, sigma.To.DesiredWidth));

                VectorGraphics.DrawSigmaSymbol(new RectangleF(left + (sectionWidth - SigmaWidth) / 2, y, SigmaWidth, SigmaHeight), g, Brushes.Black);

                if (sigma.From != null)
                {
                    sigma.From.Draw(g, style.SmallFont, style);
                }

                if (sigma.To != null)
                {
                    sigma.To.Draw(g, style.SmallFont, style);
                }


                left += sectionWidth + 5;
            }
        }
コード例 #4
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            Body.Draw(g, font, style);
            Superscript.Draw(g, font, style);

            if (HasBracket)
            {
                VectorGraphics.DrawRoundBracket(new RectangleF(Left, Top, Width - Superscript.DesiredWidth, Height), g, Brushes.Black);
            }
        }
コード例 #5
0
ファイル: RootExpression.cs プロジェクト: CodingWasaby/Mathy
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            if (Root != null)
            {
                Root.Draw(g, font, style);
            }


            X.Draw(g, font, style);

            float x = Left + (Root == null ? 0 : Root.Width);
            float y = Top + Height - X.Height - 2;

            VectorGraphics.DrawRootSymbol(new RectangleF(x, y, Left + Width - x, X.Height - 1), SymbolWidth, g, Brushes.Black);
        }
コード例 #6
0
        protected override void OnDraw(Graphics g, Font font, Style style)
        {
            float baseLine = Top + Height - Math.Max(variablesSize.Height / 2, Body.FindMaxBottom());

            float y = baseLine - variablesSize.Height / 2 - 2;


            foreach (Expression variable in Variables)
            {
                variable.Draw(g, font, style);
            }


            VectorGraphics.DrawArrow(new RectangleF(Left + variablesSize.Width, baseLine - 10, 20, 20), g, Brushes.Black);


            Body.Draw(g, font, style);
        }
コード例 #7
0
ファイル: SuperToolTip.cs プロジェクト: CecleCW/ProductMan
        private static void Render( Graphics g, Rectangle clip, SuperToolTipInfo info, int width, int height, bool balloon, Drawing.ColorTable colorTable, out VectorGraphics.Primitives.Container container )
        {
            VectorGraphics.Types.Rectangle clipRect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clip );
            VectorGraphics.Renderers.GdiPlusRenderer renderer = new VectorGraphics.Renderers.GdiPlusRenderer
                ( delegate
                    {
                        return g;
                    }, BinaryComponents.VectorGraphics.Renderers.GdiPlusRenderer.MarkerHandling.Ignore, 5 );

            container = CreateContainer( renderer, width, height, balloon, colorTable );

            g.TranslateTransform( _xoff, _yoff );
            renderer.Render( g, container, clipRect );

            int titleHeight = WinFormsUtility.Drawing.GdiPlusEx.MeasureString( g, info.Title, SystemFonts.DialogFont, width - _bodyIndent ).Height;
            Rectangle rect = new Rectangle( 0, 0, width, height );
            Rectangle titleRect = new Rectangle( rect.X + _border, rect.Y + _border, rect.Width - _border * 2, titleHeight );
            Rectangle bodyRect = new Rectangle( rect.X + _border + _bodyIndent, rect.Y + titleHeight + _border + _titleSep, rect.Width - _border * 2 - _bodyIndent, rect.Height - titleHeight - _border * 2 - _titleSep );

            using( Font font = new Font( SystemFonts.DialogFont, FontStyle.Bold ) )
            {
                WinFormsUtility.Drawing.GdiPlusEx.DrawString
                    ( g, info.Title, font, colorTable.TextColor, titleRect
                    , WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.MultiLine, WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display );
            }

            WinFormsUtility.Drawing.GdiPlusEx.DrawString
                ( g, info.Description, SystemFonts.DialogFont, colorTable.TextColor
                , bodyRect, WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.MultiLine, WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display );
        }
コード例 #8
0
ファイル: SuperToolTip.cs プロジェクト: CecleCW/ProductMan
        private static VectorGraphics.Primitives.Container CreateContainer( VectorGraphics.Renderers.Renderer renderer, int width, int height, bool balloon, Drawing.ColorTable colorTable )
        {
            VectorGraphics.Paint.Color primaryColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( colorTable.PrimaryColor );
            VectorGraphics.Paint.Color lightener = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( colorTable.GlossyLightenerColor );
            VectorGraphics.Paint.Color borderColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.5 );
            VectorGraphics.Paint.Color gradientStartColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.05 );
            VectorGraphics.Paint.Color gradientEndColor = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.2 );

            VectorGraphics.Factories.RoundedRectangle roundRectFactory = new VectorGraphics.Factories.RoundedRectangle();
            VectorGraphics.Factories.SoftShadow softShadowFactory = new VectorGraphics.Factories.SoftShadow
                ( renderer, new VectorGraphics.Types.Point( 1, 1 ), 3, new VectorGraphics.Paint.Color( 0, 0, 0, 0.3 ) );

            VectorGraphics.Types.Rectangle mainRect = new VectorGraphics.Types.Rectangle( 0, 0, width, height );
            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            double radius = 3;
            VectorGraphics.Primitives.Path shape = roundRectFactory.Create( mainRect, radius );

            if( balloon )
            {
                shape = new VectorGraphics.Primitives.Path();

                shape.Add( new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius * 2, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X - radius, mainRect.Y - radius * 7 ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius * 9, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + mainRect.Width - radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + mainRect.Width, mainRect.Y + radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + mainRect.Width, mainRect.Y + mainRect.Height - radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + mainRect.Width - radius, mainRect.Y + mainRect.Height ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y + mainRect.Height ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X, mainRect.Y + mainRect.Height - radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( mainRect.X, mainRect.Y + radius ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( mainRect.X + radius, mainRect.Y ) ) );
                shape.Add( new VectorGraphics.Primitives.Path.Close() );
            }
            else
            {
                shape = roundRectFactory.Create( mainRect, 3 );
            }

            shape.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
            shape.Brush = new VectorGraphics.Paint.Brushes.LinearGradientBrush( gradientStartColor, gradientEndColor, mainRect.TopLeft, mainRect.BottomLeft );

            container.AddBack( shape );

            softShadowFactory.Apply( container );

            return container;
        }
コード例 #9
0
ファイル: GlossyRenderer.cs プロジェクト: CecleCW/ProductMan
        private void SetSectionFont( Context context, Section section, VectorGraphics.Primitives.Text text )
        {
            VectorGraphics.Paint.Color titleColor = GetPrimaryBackgroundColor( context, section );
            VectorGraphics.Paint.Color textColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.TextColor );

            titleColor = VectorGraphics.Paint.Color.Combine( titleColor, textColor, 0.5 );

            text.FontFamily = SystemFonts.DialogFont.FontFamily.Name;
            text.FontSizePoints = SystemFonts.DialogFont.SizeInPoints;
            text.Color = titleColor;
        }
コード例 #10
0
ファイル: GlossyRenderer.cs プロジェクト: CecleCW/ProductMan
        private VectorGraphics.Primitives.Path CreateRoundRectHighlight( Context context, VectorGraphics.Types.Rectangle rect, double radius )
        {
            VectorGraphics.Primitives.Path path = new VectorGraphics.Primitives.Path();
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, 0 );

            path.Add( new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( rect.X, rect.Y + rect.Height - radius ) ) );
            path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X, rect.Y + radius ) ) );
            path.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( rect.X + radius, rect.Y ) ) );
            path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X + rect.Width - radius, rect.Y ) ) );

            path.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( lightener, 0.6 ), 1 );

            return path;
        }
コード例 #11
0
ファイル: GlossyRenderer.cs プロジェクト: CecleCW/ProductMan
        private VectorGraphics.Paint.Brushes.Brush CreateItemBrush( Context context, Item item, double glow, double overGlow, VectorGraphics.Types.Rectangle rect, BackgroundStyle backgroundStyle )
        {
            VectorGraphics.Factories.GlossyBrush glossyBrushFactory = CreateGlossyBrushFactory( context, glow );
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBackgroundColor( context, item == null ? null : item.Section );
            VectorGraphics.Paint.Color glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowColor );
            VectorGraphics.Paint.Color glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowHighlightColor );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                primaryColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
                glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
            }
            else
            {
                if( (backgroundStyle & BackgroundStyle.Pressed) != 0 )
                {
                    glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                    glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                }
            }

            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, glow );
            VectorGraphics.Paint.Color primaryEnd = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.6 );

            primaryColor = new VectorGraphics.Paint.Color( primaryColor, overGlow );
            primaryEnd = new VectorGraphics.Paint.Color( primaryEnd, overGlow );
            glowStartColor = new VectorGraphics.Paint.Color( glowStartColor, overGlow );
            glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, overGlow );

            return glossyBrushFactory.Create
                ( VectorGraphics.Paint.Color.Combine( primaryColor, glowStartColor, 1 - glow )
                , VectorGraphics.Paint.Color.Combine( primaryEnd, glowEndColor, 1 - glow )
                , rect.Top, rect.Bottom );
        }
コード例 #12
0
ファイル: GlossyRenderer.cs プロジェクト: CecleCW/ProductMan
        protected VectorGraphics.Paint.Brushes.Brush CreateSectionBrush( Context context, Section section, double glow, VectorGraphics.Types.Rectangle rect )
        {
            VectorGraphics.Factories.GlossyBrush glossyBrushFactory = CreateGlossyBrushFactory( context, section, glow / 2 );
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBackgroundColor( context, section );
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, section, 0 );

            return glossyBrushFactory.Create( VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 1 - glow / 3 ), rect.Top, rect.Bottom );
        }
コード例 #13
0
ファイル: AbsExpression.cs プロジェクト: CodingWasaby/Mathy
 protected override void OnDraw(Graphics g, Font font, Style style)
 {
     Operand.Draw(g, font, style);
     VectorGraphics.DrawAbsSymbol(new RectangleF(Left, Top, Width, Height), g, Brushes.Black);
 }
コード例 #14
0
ファイル: TreeControl.cs プロジェクト: CecleCW/ProductMan
            private VectorGraphics.Primitives.Path CreateRoundRectHighlight( VectorGraphics.Types.Rectangle rect, double radius )
            {
                VectorGraphics.Primitives.Path path = new VectorGraphics.Primitives.Path();
                VectorGraphics.Paint.Color glossyGlowLightenerColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlossyGlowLightenerColor );

                path.Add( new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( rect.X, rect.Y + rect.Height - radius ) ) );
                path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X, rect.Y + radius ) ) );
                path.Add( new VectorGraphics.Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new VectorGraphics.Types.Point( rect.X + radius, rect.Y ) ) );
                path.Add( new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( rect.X + rect.Width - radius, rect.Y ) ) );

                path.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( glossyGlowLightenerColor, 0.6 ), 1 );

                return path;
            }
コード例 #15
0
ファイル: TreeControl.cs プロジェクト: CecleCW/ProductMan
            private VectorGraphics.Primitives.Container CreateNodeItem( VectorGraphics.Renderers.Renderer renderer, Rectangle nodeRect, bool isSelected, double glow )
            {
                VectorGraphics.Paint.Color glowHighlightColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowHighlightColor );
                VectorGraphics.Paint.Color glossyGlowLightenerColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlossyGlowLightenerColor );
                VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowColor );
                VectorGraphics.Paint.Color white = VectorGraphics.Paint.Color.White;

                VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();
                VectorGraphics.Factories.GlossyBrush glossyBrushFactory = new VectorGraphics.Factories.GlossyBrush( glossyGlowLightenerColor );

                VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

                VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( nodeRect );

                VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

                container.AddBack( roundedRect );

                if( isSelected )
                {
                    VectorGraphics.Paint.Color borderColor = glowColor;
                    VectorGraphics.Paint.Color glowStartColor = glowColor;
                    VectorGraphics.Paint.Color glowEndColor = glowHighlightColor;

                    if( !_treeControl.Focused )
                    {
                        borderColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayForegroundColor );
                        glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayForegroundColor );
                        glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayBackgroundColor );
                    }

                    roundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
                    roundedRect.Brush = glossyBrushFactory.Create( glowStartColor, glowEndColor, nodeRect.Top, nodeRect.Bottom );

                    rect = VectorGraphics.Types.Rectangle.Shrink( rect, 1 );

                    container.AddBack( CreateRoundRectHighlight( rect, 2 ) );
                }
                else if( glow > 0 )
                {
                    VectorGraphics.Paint.Color borderColor = glowHighlightColor;
                    VectorGraphics.Paint.Color glowStartColor = glowColor;
                    VectorGraphics.Paint.Color glowEndColor = glowHighlightColor;

                    borderColor = VectorGraphics.Paint.Color.Combine( borderColor, white, 0.7 );
                    glowStartColor = VectorGraphics.Paint.Color.Combine( glowStartColor, white, 0.4 );
                    glowEndColor = VectorGraphics.Paint.Color.Combine( glowEndColor, white, 0.4 );

                    borderColor = new VectorGraphics.Paint.Color( borderColor, glow );
                    glowStartColor = new VectorGraphics.Paint.Color( glowStartColor, glow );
                    glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, glow );

                    roundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( borderColor, 1 );
                    roundedRect.Brush = glossyBrushFactory.Create( glowStartColor, glowEndColor, nodeRect.Top, nodeRect.Bottom );
                }

                return container;
            }
コード例 #16
0
ファイル: TreeControl.cs プロジェクト: CecleCW/ProductMan
            private VectorGraphics.Primitives.Container CreateExpandCollapseItem( VectorGraphics.Renderers.Renderer renderer, double borderGlow, double glow, bool over )
            {
                VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

                VectorGraphics.Primitives.Path arrow = new VectorGraphics.Primitives.Path( new VectorGraphics.Primitives.Path.Command[]
                    {
                        new VectorGraphics.Primitives.Path.Move( new VectorGraphics.Types.Point( -_ecSize / 4, -_ecSize / 2 ) ),
                        new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( _ecSize / 3, 0 ) ),
                        new VectorGraphics.Primitives.Path.Line( new VectorGraphics.Types.Point( -_ecSize / 4, _ecSize / 2 ) ),
                        new VectorGraphics.Primitives.Path.Close()
                    } );

                VectorGraphics.Paint.Color greyColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GrayTextColor );
                VectorGraphics.Paint.Color glowDeepColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowDeepColor );
                VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( _colorTable.GlowColor );
                VectorGraphics.Paint.Color bgColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( SystemColors.Window );

                glowColor = VectorGraphics.Paint.Color.Combine( glowColor, bgColor, 0.7 );

                VectorGraphics.Paint.Color borderColor = VectorGraphics.Paint.Color.Combine( glowDeepColor, greyColor, glow );

                arrow.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( borderColor, borderGlow ), 1 );

                container.AddBack( arrow );

                if( glow > 0 )
                {
                    arrow.Brush = new VectorGraphics.Paint.Brushes.SolidBrush( new VectorGraphics.Paint.Color( glowColor, glow ) );

                    VectorGraphics.Factories.SoftShadow shadow = new VectorGraphics.Factories.SoftShadow
                        ( renderer, new BinaryComponents.VectorGraphics.Types.Point( 0, 0 ), 3
                        , new VectorGraphics.Paint.Color( glowColor, glow ) );

                    shadow.Apply( container );
                }

                return container;
            }