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


C# XML.ProjectLayoutElement类代码示例

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


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

示例1: TranslateToElementString

 protected override ElementString TranslateToElementString(string sRawString, int nCardIndex, DeckLine zDeckLine, ProjectLayoutElement zElement)
 {
     using (var engine = new V8ScriptEngine())
     {
         var sScript = GetJavaScript(nCardIndex, zDeckLine, sRawString);
         try
         {
             var sValue = engine.Evaluate(sScript);
             if (sValue is string || sValue is int)
             {
                 return new ElementString()
                 {
                     String = sValue.ToString()
                 };
             }
             else
             {
                 Logger.AddLogLine(sValue.GetType().ToString());
             }
         }
         catch (Exception e)
         {
             Logger.AddLogLine(e.Message);
         }
     }
     return new ElementString()
     {
         String = string.Empty
     };
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:30,代码来源:JavaScriptTranslator.cs

示例2: GetLargestMarkupHeight

        protected float GetLargestMarkupHeight(ProjectLayoutElement zElement, List<MarkupBase> listMarkups)
        {
            if (0 == listMarkups.Count)
            {
                return 0;
            }

            var zLastMarkup = listMarkups[listMarkups.Count - 1];
            var nLineNumber = zLastMarkup.LineNumber;
            // find the largest total height on the last row (inclusive of the Y position)
            var fLargestTotal = zLastMarkup.TargetRect.Y + zLastMarkup.TargetRect.Height;
            var nIdx = listMarkups.Count - 2;
            while (nIdx > -1)
            {
                var zMarkup = listMarkups[nIdx];
                if (nLineNumber == zMarkup.LineNumber)
                {
                    fLargestTotal = Math.Max(fLargestTotal, zMarkup.TargetRect.Y + zMarkup.TargetRect.Height);
                }
                else
                {
                    break;
                }
                nIdx--;
            }
            return fLargestTotal;
        }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:27,代码来源:VerticalAlignmentProcessor.cs

示例3: ProcessMarkup

        public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
        {
            MarkupToClose.CloseMarkup(zData, zProcessData, zGraphics);

            // keep only the necessary markups
            return s_dictionaryKeepTypesOnProcess.ContainsKey(MarkupToClose.GetType());
        }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:7,代码来源:CloseTagMarkup.cs

示例4: ProcessMarkup

        public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
        {
            var arrayComponents = m_sVariable.Split(new char[] { ';' });
            if (1 > arrayComponents.Length)
            {
                return false;
            }

            int nXPush;
            if (!int.TryParse(arrayComponents[0], out nXPush))
            {
                return false;
            }

            var nYPush = 0;
            if (2 <= arrayComponents.Length)
            {
                if (!int.TryParse(arrayComponents[1], out nYPush))
                {
                    return false;
                }
            }

            zProcessData.CurrentX += nXPush;
            zProcessData.CurrentY += nYPush;
            if (zProcessData.CurrentX > zElement.width)
            {
                zProcessData.MoveToNextLine(zElement);
            }

            return false;
        }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:32,代码来源:PushMarkup.cs

示例5: ProcessMarkup

        public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
        {
            int nSpaces;
            if (!int.TryParse(m_sVariable, out nSpaces))
            {
                return false;
            }

            LineNumber = zProcessData.CurrentLine;

            float fWidth = (float)nSpaces * ((float)zProcessData.FontSpaceWidth + (float)zElement.wordspace);

            if (0 == fWidth)
            {
                return false;
            }

            if (zProcessData.CurrentX + fWidth >= zElement.width)
            {
                if (Optional)
                {
                    return false;
                }
                zProcessData.MoveToNextLine(zElement);
            }

            TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fWidth, zProcessData.FontSpaceHeight);

            zProcessData.CurrentX += fWidth;
            return true;
        }
开发者ID:NotNemesis,项目名称:cardmaker,代码行数:31,代码来源:SpaceMarkup.cs

示例6: DrawGraphic

        private static void DrawGraphic(Graphics zGraphics, string sFile, ProjectLayoutElement zElement)
        {
            string sPath = sFile;
            if (sPath.Equals("none", StringComparison.CurrentCultureIgnoreCase))
            {
                return;
            }
            if (!File.Exists(sPath))
            {
                sPath = CardMakerMDI.ProjectPath + sFile;
            }
            if (File.Exists(sPath))
            {
                var zBmp = 255 != zElement.opacity
                    ? LoadOpacityImageFromCache(sPath, zElement)
                    : LoadImageFromCache(sPath);

                int nWidth = zElement.width;
                int nHeight = zElement.height;

                if (zElement.keeporiginalsize)
                {
                    DrawGraphicOriginalSize(zGraphics, zBmp, zElement);
                    return;
                }

                if (zElement.lockaspect)
                {
                    var fAspect = (float)zBmp.Tag;

                    var nTargetHeight = (int)((float)nWidth / fAspect);
                    if (nTargetHeight < nHeight)
                    {
                        nHeight = (int)((float)nWidth / fAspect);
                    }
                    else
                    {
                        nWidth = (int)((float)nHeight * fAspect);
                    }
                }

                int nX = 0;
                int nY = 0;

                // standard alignment adjustment
                UpdateAlignmentValue(zElement.horizontalalign, ref nX, zElement.width, nWidth);
                UpdateAlignmentValue(zElement.verticalalign, ref nY, zElement.height, nHeight);

                zGraphics.DrawImage(zBmp, nX, nY, nWidth, nHeight);

            }
            else
            {
                MDIIssues.Instance.AddIssue("Image file not found: " + sFile);
            }
            // draw nothing
        }
开发者ID:NotNemesis,项目名称:cardmaker,代码行数:57,代码来源:DrawGraphic.cs

示例7: GetVerticalAlignOffset

        public override float GetVerticalAlignOffset(ProjectLayoutElement zElement, List<MarkupBase> listMarkups)
        {
            if (0 == listMarkups.Count)
            {
                return 0;
            }

            return (((float)zElement.height - GetLargestMarkupHeight(zElement, listMarkups))) / 2f;
        }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:9,代码来源:VerticalMiddleAlignmentProcessor.cs

示例8: ProcessMarkup

 public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
 {
     float fNewSize;
     if (float.TryParse(m_sVariable, out fNewSize) && fNewSize > 0)
     {
         m_zPreviousFont = zProcessData.Font;
         zProcessData.SetFont(new Font(zProcessData.Font.FontFamily, fNewSize, zProcessData.Font.Style), zGraphics);
     }
     return false;
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:10,代码来源:FontSizeMarkup.cs

示例9: DrawElementDebugBorder

 public static void DrawElementDebugBorder(Graphics zGraphics, ProjectLayoutElement zElement, int nX, int nY, bool bSelected)
 {
     // note that the border is inclusive in the width/height consuming 2 pixels (0 to total-1)
     zGraphics.TranslateTransform(nX, nY);
     zGraphics.DrawRectangle(s_zPenDebugBorder, zElement.x, zElement.y, zElement.width - 1, zElement.height - 1);
     if (bSelected)
     {
         zGraphics.DrawRectangle(m_zPenElementSelect, zElement.x - 2, zElement.y - 2, zElement.width + 3, zElement.height + 3);
     }
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:10,代码来源:DrawItem.cs

示例10: ProcessMarkup

 public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
 {
     float fYOffset;
     if (float.TryParse(m_sVariable, out fYOffset))
     {
         m_fPreviousOffset = zProcessData.CurrentYOffset;
         zProcessData.CurrentYOffset = fYOffset;
     }
     return false;
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:10,代码来源:YDrawOffsetMarkup.cs

示例11: UpdateLineAlignment

 /// <summary>
 /// Updates the position of the markups based on horizontal alignment
 /// </summary>
 /// <param name="nFirst"></param>
 /// <param name="nLast"></param>
 /// <param name="bLastLine"></param>
 /// <param name="zElement"></param>
 /// <param name="listMarkups">List of Markups (all must have Aligns set to true)</param>
 /// <param name="fVerticalOffset">Any vertical offset to apply</param>
 /// <param name="listAllMarkups"></param>
 public virtual void UpdateLineAlignment(int nFirst, int nLast, bool bLastLine, ProjectLayoutElement zElement,
     List<MarkupBase> listMarkups, float fVerticalOffset, IEnumerable<MarkupBase> listAllMarkups)
 {
     var fHorizontalOffset = GetHorizontalOffset(zElement, listMarkups[nLast].TargetRect);
     for (var nIdx = nFirst; nIdx <= nLast; nIdx++)
     {
         var rectCurrent = listMarkups[nIdx].TargetRect;
         listMarkups[nIdx].TargetRect = new RectangleF(rectCurrent.X + fHorizontalOffset, rectCurrent.Y + fVerticalOffset, rectCurrent.Width, rectCurrent.Height);
     }
 }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:20,代码来源:HorizontalAlignmentProcessor.cs

示例12: ProcessMarkup

 public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
 {
     var zNewFont = ProjectLayoutElement.TranslateFontString(m_sVariable);
     if (zNewFont != null)
     {
         m_zPreviousFont = zProcessData.Font;
         zProcessData.SetFont(zNewFont, zGraphics);
         return true;
     }
     return false;
 }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:11,代码来源:FontMarkup.cs

示例13: Render

 public void Render(ProjectLayoutElement zElement, Graphics zGraphics)
 {
     foreach (var zRenderType in s_zTypeRenderOrder)
     {
         foreach (var zMarkup in m_dictionaryTypeMarkupList[zRenderType])
         {
             if (!zMarkup.Render(zElement, zGraphics))
             {
                 RenderLackOfSpaceWarning(zElement, zGraphics);
             }
         }
     }         
 }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:13,代码来源:FormattedTextDataCache.cs

示例14: UpdateLineAlignment

        public override void UpdateLineAlignment(int nFirst, int nLast, bool bLastLine, ProjectLayoutElement zElement, List<MarkupBase> listMarkups, float fVerticalOffset, IEnumerable<MarkupBase> listAllMarkups)
        {
            // detect if this is the last line of markups - if so don't bother with jusity alignment
            if (bLastLine)
            {
                base.UpdateLineAlignment(nFirst, nLast, bLastLine, zElement, listMarkups, fVerticalOffset, listAllMarkups);
                return;
            }
            // detect if this line is followed by a line break - if so don't bother with justify alignment on this line
            var lastLineMarkup = listMarkups[nLast];
            var theBigList = listAllMarkups.ToList();
            var lastLineMarkupIndex = theBigList.IndexOf(lastLineMarkup);
            for (var nIdx = lastLineMarkupIndex + 1; nIdx < theBigList.Count; nIdx++)
            {
                if (theBigList[nIdx] is NewlineMarkup)
                {
                    // no justified alignment due to this line ending with an explicit line break
                    base.UpdateLineAlignment(nFirst, nLast, bLastLine, zElement, listMarkups, fVerticalOffset, listAllMarkups);
                    return;
                }
                if (theBigList[nIdx].Aligns)
                {
                    // the next rendered thing aligns so treat this line as though it is part of a paragraph
                    break;
                }
                // default to justify alignment
            }

            // TODO: the space markups are completely ignored by justified (who cares?)
            var listTextMarkups = listMarkups.GetRange(nFirst, (nLast - nFirst) + 1).Where(zMarkup => !(zMarkup is SpaceMarkup)).ToList();
            var fTotalTextWidth = listTextMarkups.Sum(zMarkup => zMarkup.TargetRect.Width);
            var fDifference = (float)zElement.width - fTotalTextWidth;

            var fXOffset = fDifference / ((float)listTextMarkups.Count - 1);

            //Logger.AddLogLine("TotalTextWidth: {0} Difference: {1} SpaceSize: {2} listTextMarkups: {3}".FormatString(fTotalTextWidth, fDifference, fXOffset, listTextMarkups.Count));
            var fCurrentPosition = listMarkups[nFirst].TargetRect.X;
            for (var nIdx = nFirst; nIdx <= nLast; nIdx++)
            {
                if (listMarkups[nIdx].Aligns && !(listMarkups[nIdx] is SpaceMarkup))
                {
                    var rectCurrent = listMarkups[nIdx].TargetRect;
                    listMarkups[nIdx].TargetRect = new RectangleF(fCurrentPosition,
                        rectCurrent.Y + fVerticalOffset, rectCurrent.Width, rectCurrent.Height);
                    fCurrentPosition += listMarkups[nIdx].TargetRect.Width + fXOffset;
                }
            }
        }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:48,代码来源:HorizontalJustifiedAlignmentProcessor.cs

示例15: Render

 public override bool Render(ProjectLayoutElement zElement, Graphics zGraphics)
 {
     // Custom Graphics Setting
     // disable smoothing so the background color has a sharp edge
     SmoothingMode ePreviousSmoothingMode = zGraphics.SmoothingMode;
     zGraphics.SmoothingMode = SmoothingMode.None;
     foreach (var rect in m_listRectangles)
     {
         var rectAdjusted = rect;
         // do not draw any rectangles outside of the element
         rectAdjusted.Height = Math.Min(rect.Bottom - rect.Top, zElement.y + zElement.height);
         zGraphics.FillRectangle(m_zBrush, rectAdjusted);
     }
     zGraphics.SmoothingMode = ePreviousSmoothingMode;
     return true;
 }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:16,代码来源:BackgroundColorMarkup.cs


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