当前位置: 首页>>代码示例>>C#>>正文


C# ProjectLayoutElement.GetElementColor方法代码示例

本文整理汇总了C#中CardMaker.XML.ProjectLayoutElement.GetElementColor方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectLayoutElement.GetElementColor方法的具体用法?C# ProjectLayoutElement.GetElementColor怎么用?C# ProjectLayoutElement.GetElementColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CardMaker.XML.ProjectLayoutElement的用法示例。


在下文中一共展示了ProjectLayoutElement.GetElementColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdatePanelColors

 private void UpdatePanelColors(ProjectLayoutElement zElement)
 {
     if (zElement != ElementManager.Instance.GetSelectedElement())
     {
         return;
     }
     panelBorderColor.BackColor = zElement.GetElementBorderColor();
     panelOutlineColor.BackColor = zElement.GetElementOutlineColor();
     panelShapeColor.BackColor = zElement.GetElementColor();
     panelFontColor.BackColor = panelShapeColor.BackColor;
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:11,代码来源:MDIElementControl.cs

示例2: HandleShapeRender

        public static void HandleShapeRender(Graphics zGraphics, string sShapeInfo, ProjectLayoutElement zElement)
        {
            if (s_regexShapes.IsMatch(sShapeInfo))
            {
                var zMatch = s_regexShapes.Match(sShapeInfo);
                ShapeInfo zInfo = null;
                var bParse = false;
                var arraySplit = zMatch.Groups[3].ToString().Split(new char[] { ';' });
                var sShapeName = arraySplit[(int)AbstractShape.ShapeInformationIndex.Name];
                AbstractShape zShape;
                if (s_dictionaryShapeByName.TryGetValue(sShapeName, out zShape))
                {
                    // allow any shapes with extended settings to read in the values (ShapeInformationIndex extension)
                    zShape.InitializeItem(sShapeInfo);

                    if ((int)AbstractShape.ShapeInformationIndex.BasicShapeInformation < arraySplit.Length)
                    {
                        int nThickness;
                        var nOverrideWidth = int.MinValue;
                        var nOverrideHeight = int.MinValue;
                        bParse = int.TryParse(arraySplit[(int)AbstractShape.ShapeInformationIndex.Thickness], out nThickness);
                        if (!arraySplit[(int)AbstractShape.ShapeInformationIndex.OverrideWidth].Equals(AbstractShape.NO_SIZE_OVERRIDE))
                            bParse &= int.TryParse(arraySplit[(int)AbstractShape.ShapeInformationIndex.OverrideWidth], out nOverrideWidth);
                        if (!arraySplit[(int)AbstractShape.ShapeInformationIndex.OverrideHeight].Equals(AbstractShape.NO_SIZE_OVERRIDE))
                            bParse &= int.TryParse(arraySplit[(int)AbstractShape.ShapeInformationIndex.OverrideHeight], out nOverrideHeight);
                        zInfo = new ShapeInfo(nThickness, nOverrideWidth, nOverrideHeight, arraySplit);
                    }
                    if (!bParse)
                    {
                        return; // invalid (error?)
                    }

                    var previousTransform = zGraphics.Transform;
                    var zPath = new GraphicsPath();

                    var targetRect = new Rectangle(0, 0, zElement.width - 1, zElement.height - 1);

                    // internally int.MinValue indicates no override
                    if (int.MinValue != zInfo.OverrideWidth || int.MinValue != zInfo.OverrideHeight)
                    {
                        var nOverrideWidth = int.MinValue == zInfo.OverrideWidth ? zElement.width : zInfo.OverrideWidth;
                        var nOverrideHeight = int.MinValue == zInfo.OverrideHeight ? zElement.height : zInfo.OverrideHeight;

                        if (0 == nOverrideWidth || 0 == nOverrideHeight)
                            // nothing to draw
                            return;
                        targetRect = GetZeroRectangle(nOverrideWidth, nOverrideHeight);
                        zGraphics.TranslateTransform(targetRect.X, targetRect.Y);
                        targetRect = new Rectangle(0, 0, Math.Abs(nOverrideWidth), Math.Abs(nOverrideHeight));
                    }

                    zShape.DrawShape(zPath, targetRect, zInfo);
                    DrawItem.DrawOutline(zElement, zGraphics, zPath);

                    if (0 == zInfo.Thickness)
                    {
                        var zShapeBrush = 255 != zElement.opacity 
                            ? new SolidBrush(Color.FromArgb(zElement.opacity, zElement.GetElementColor()))
                            : new SolidBrush(zElement.GetElementColor());
                        zGraphics.FillPath(zShapeBrush, zPath);
                    }
                    else
                    {
                        var zShapePen = 255 != zElement.opacity
                            ? new Pen(Color.FromArgb(zElement.opacity, zElement.GetElementColor()), zInfo.Thickness)
                            : new Pen(zElement.GetElementColor(), zInfo.Thickness);
                        zGraphics.DrawPath(zShapePen, zPath);
                    }
                    zGraphics.Transform = previousTransform;
                }
            }
        }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:72,代码来源:ShapeManager.cs

示例3: DrawElement

        public static void DrawElement(Graphics zGraphics, Deck zDeck, ProjectLayoutElement zElement, ElementType eType, int nX, int nY, string sInput)
        {
            switch (eType)
            {
                case ElementType.Graphic:
                case ElementType.Shape:
                    sInput = sInput.Trim();
                    break;
            }

            Font zFont = null;
            Brush zBrush = null;
            Pen zBorderPen = null;

            Color colorFont = Color.Black;

            if (0 != zElement.borderthickness)
            {
                zBorderPen = 255 != zElement.opacity
                    ? new Pen(Color.FromArgb(zElement.opacity, zElement.GetElementBorderColor()), zElement.borderthickness)
                    : new Pen(zElement.GetElementBorderColor(), zElement.borderthickness);
            }

            // Setup
            switch (eType)
            {
                case ElementType.Text:
                case ElementType.FormattedText:
                    zFont = zElement.GetElementFont();
                    colorFont = zElement.GetElementColor();
                    zBrush = new SolidBrush(colorFont);
                    break;
                case ElementType.Graphic:
                case ElementType.Shape:
                    break;
                default:
                    return;
            }

            // NOTE: this is the first transform
            if (0 != zElement.rotation)
            {
                // center the internal element then rotate and restore
                zGraphics.TranslateTransform(zElement.x + nX + (zElement.width >> 1), zElement.y + nY + (zElement.height >> 1));
                zGraphics.RotateTransform(zElement.rotation);
                zGraphics.TranslateTransform(-(zElement.width >> 1), -(zElement.height >> 1));
            }
            else
            {
                zGraphics.TranslateTransform(zElement.x + nX, zElement.y + nY);
            }
            // TODO: an interface for all these would be more appropriate

            // Draw
            switch (eType)
            {
                case ElementType.Text:
                    DrawText(zGraphics, zElement, sInput, zBrush, zFont, colorFont);
                    break;
                case ElementType.FormattedText:
                    DrawFormattedText(zGraphics, zDeck, zElement, sInput, zBrush, zFont, colorFont);
                    break;
                case ElementType.Graphic:
                    DrawGraphic(zGraphics, sInput, zElement);
                    break;
                case ElementType.Shape:
                    ShapeManager.HandleShapeRender(zGraphics, sInput.ToLower(), zElement);
                    break;
            }

            if (null != zBorderPen)
            {
                // note that the border is inclusive in the width/height consuming 2 pixels (0 to total-1)
                zGraphics.DrawRectangle(zBorderPen, 0,0,zElement.width - 1, zElement.height - 1);
            }

            zGraphics.ResetTransform();
        }
开发者ID:NotNemesis,项目名称:cardmaker,代码行数:78,代码来源:DrawItem.cs

示例4: UpdatePanelColors

 private void UpdatePanelColors(ProjectLayoutElement zElement)
 {
     if (zElement != MDILayoutControl.Instance.GetSelectedLayoutElement()) return;
     panelBorderColor.BackColor = zElement.GetElementBorderColor();
     panelOutlineColor.BackColor = zElement.GetElementOutlineColor();
     panelShapeColor.BackColor = zElement.GetElementColor();
     panelFontColor.BackColor = panelShapeColor.BackColor;
 }
开发者ID:NotNemesis,项目名称:cardmaker,代码行数:8,代码来源:MDIElementControl.cs


注:本文中的CardMaker.XML.ProjectLayoutElement.GetElementColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。