• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# XML.ProjectLayoutElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: PostProcessMarkupRectangle

        public override bool PostProcessMarkupRectangle(ProjectLayoutElement zElement, List<MarkupBase> listAllMarkups, int nMarkup)
        {
            m_listRectangles = new List<RectangleF>();
            for (var nIdx = nMarkup + 1; nIdx < listAllMarkups.Count; nIdx++)
            {
                var zMarkup = listAllMarkups[nIdx];

                // check if the markup is closed
                if (typeof(CloseTagMarkup) == zMarkup.GetType() &&
                    this == ((CloseTagMarkup)zMarkup).MarkupToClose)
                    break;

                m_listRectangles.Add(zMarkup.TargetRect);
            }

            return true;
        }
开发者ID:nhmkdev,项目名称:cardmaker,代码行数:17,代码来源:BackgroundColorMarkup.cs


示例17: 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);
     if (bSelected && CardMakerInstance.DrawSelectedElementGuides)
     {
         zGraphics.DrawLine(s_zPenDebugGuides, new PointF(0, zElement.y), new PointF(zGraphics.ClipBounds.Width, zElement.y));
         zGraphics.DrawLine(s_zPenDebugGuides, new PointF(0, zElement.y + zElement.height - 1),
             new PointF(zGraphics.ClipBounds.Width, zElement.y + zElement.height));
         zGraphics.DrawLine(s_zPenDebugGuides, new PointF(zElement.x, 0), new PointF(zElement.x, zGraphics.ClipBounds.Height));
         zGraphics.DrawLine(s_zPenDebugGuides, new PointF(zElement.x + zElement.width - 1, 0),
             new PointF(zElement.x + zElement.width, zGraphics.ClipBounds.Height));
     }
     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:nhmkdev,项目名称:cardmaker,代码行数:19,代码来源:DrawItem.cs


示例18: ProcessMarkup

        public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics)
        {
            m_zFontBrush = zProcessData.FontBrush;
            m_zFont = zProcessData.Font;
            m_fFontHeight = zProcessData.FontHeight;
            m_fXOffset = zProcessData.CurrentXOffset;
            m_fYOffset = zProcessData.CurrentYOffset;

            LineNumber = zProcessData.CurrentLine;

            m_fFontOutlineSize = m_zFont.Size;

            // TODO: stop recalculating this, store it in the processData
            if (0 != zElement.outlinethickness)
            {
                switch (m_zFont.Unit)
                {
                    case GraphicsUnit.Point:
                        m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / 72f);
                        break;
                    default:
                        Logger.AddLogLine("This font is using the Unit: {0} (not currently supported)".FormatString(m_zFont.Unit.ToString()));
                        break;
                }
            }

            m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont);

            var fMeasuredWidth = m_rectMeasuredRectangle.Width;

            var fMeasuredHeight = Math.Max(m_rectMeasuredRectangle.Height, m_fFontHeight);

            if (zProcessData.CurrentX + fMeasuredWidth > zElement.width)
            {
                zProcessData.MoveToNextLine(zElement);
            }

            TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, fMeasuredHeight);

            zProcessData.CurrentX += fMeasuredWidth;            

            return true;
        }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:43,代码来源:TextMarkup.cs


示例19: ProcessMarkup

        /// <summary>
        /// Processes the image markup and if the image is valid associates it with the current process data.
        /// </summary>
        /// <param name="zElement"></param>
        /// <param name="zData"></param>
        /// <param name="zProcessData"></param>
        /// <param name="zGraphics"></param>
        /// <returns>false -  The BackgroundImageMarkup.Render is called as part of a TextMarkup</returns>
        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;
            }
            LineNumber = zProcessData.CurrentLine;

            m_sImageFile = arrayComponents[0];

            var zBmp = DrawItem.LoadImageFromCache(m_sImageFile);

            m_fXOffset = zProcessData.CurrentXOffset;
            m_fYOffset = zProcessData.CurrentYOffset;

            if (null != zBmp)
            {
                switch (arrayComponents.Length)
                {
                    case 1:
                        m_nWidth = zBmp.Width;
                        m_nHeight = zBmp.Height;
                        TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0);
                        return true;
                    case 5:
                        {
                            if (float.TryParse(arrayComponents[1], out m_fXOffset) &&
                                float.TryParse(arrayComponents[2], out m_fYOffset) &&
                                int.TryParse(arrayComponents[3], out m_nWidth) &&
                                int.TryParse(arrayComponents[4], out m_nHeight))
                            {
                                TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0);
                                return true;
                            }
                        }
                        break;
                }
            }

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


示例20: TranslateString

        public ElementString TranslateString(string sRawString, int nCardIndex, DeckLine zDeckLine,
            ProjectLayoutElement zElement, string sCacheSuffix = "")
        {
            string sCacheKey = zElement.name + sCacheSuffix;
            ElementString zCached;
            if (m_dictionaryElementStringCache.TryGetValue(sCacheKey, out zCached))
            {
                return zCached;
            }

            var zElementString = TranslateToElementString(sRawString, nCardIndex, zDeckLine, zElement);

            if (zElementString.String.Contains("#nodraw"))
            {
                zElementString.DrawElement = false;
            }

            // all translators perform this post replacement operation
            switch ((ElementType)Enum.Parse(typeof(ElementType), zElement.type))
            {
                case ElementType.Text:
                    zElementString.String = zElementString.String.Replace("\\n", Environment.NewLine);
                    zElementString.String = zElementString.String.Replace("\\q", "\"");
                    zElementString.String = zElementString.String.Replace("\\c", ",");
                    zElementString.String = zElementString.String.Replace("&gt;", ">");
                    zElementString.String = zElementString.String.Replace("&lt;", "<");
                    break;
                case ElementType.FormattedText:
                    zElementString.String = zElementString.String.Replace("<c>", ",");
                    zElementString.String = zElementString.String.Replace("<q>", "\"");
                    zElementString.String = zElementString.String.Replace("&gt;", ">");
                    zElementString.String = zElementString.String.Replace("&lt;", "<");
                    break;
            }

            AddStringToTranslationCache(sCacheKey, zElementString);

            return zElementString;
        }
开发者ID:ksuquix,项目名称:cardmaker,代码行数:39,代码来源:TranslatorBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.ContentPage类代码示例发布时间:2022-05-24
下一篇:
C# GameLogic.Snap类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap