Ejemplo n.º 1
0
        //----------------------------------------------------------------------
        /// <summary>
        /// Change font detail for an item in the trace
        /// </summary>
        /// <param name="colId">Column index : All columns=-1, Col1=0, Col2=1, Col3=2</param>
        /// <param name="bold">Change font to bold</param>
        /// <param name="italic">Change font to Italic</param>
        /// <param name="color">Change Color. To reduce the number assembly reference, the Color structure is not used. Use YourColor.ToArgb() instead. Use -1 to keep default color</param>
        /// <param name="size">Change font size, use zero to keep normal size</param>
        /// <param name="fontName">Change font name</param>
        /// <returns>The TMember node</returns>
        public TMemberNode SetFontDetail(int colId, bool bold, bool italic, int color, int size, string fontName)
        {
            FontDetail fontDetail = new FontDetail();

            fontDetail.ColId    = colId;
            fontDetail.Bold     = bold;
            fontDetail.Italic   = italic;
            fontDetail.Color    = color;
            fontDetail.Size     = size;
            fontDetail.FontName = fontName;

            if (FontDetails == null)
            {
                FontDetails = new FontDetailList();
            }

            FontDetails.Add(fontDetail);
            return(this);
        }
Ejemplo n.º 2
0
        //----------------------------------------------------------------------
        // internal use only, used to recursively add sub members to the array
        internal void _AddToStringList(StringList commandList)
        {
            // create the member and set col1
            Helper.AddCommand(commandList, TraceConst.CST_CREATE_MEMBER, Col1);
            // add command if col2 and/or col3 exist
            if (Col2 != "")
            {
                Helper.AddCommand(commandList, TraceConst.CST_MEMBER_COL2, Col2);
            }

            if (Col3 != "")
            {
                Helper.AddCommand(commandList, TraceConst.CST_MEMBER_COL3, Col3);
            }

            // add viewer kind
            if (ViewerKind != 0)
            {
                Helper.AddCommand(commandList, TraceConst.CST_MEMBER_VIEWER_KIND, ViewerKind);
            }

            // add font detail
            if (FontDetails != null)
            {
                foreach (FontDetail fontDetail in FontDetails)
                {
                    StringBuilder tempStr = new StringBuilder();

                    tempStr.Append(String.Format("{0,5}{1,3}", TraceConst.CST_MEMBER_FONT_DETAIL, fontDetail.ColId));


                    if (fontDetail.Bold)
                    {
                        tempStr.Append("1");
                    }
                    else
                    {
                        tempStr.Append("0");
                    }

                    if (fontDetail.Italic)
                    {
                        tempStr.Append("1");
                    }
                    else
                    {
                        tempStr.Append("0");
                    }

                    int colorValue;
                    if (fontDetail.Color == -1)
                    {
                        colorValue = -1;
                    }
                    else
                    {
                        // remove Alpha blending
                        colorValue = fontDetail.Color & 0xFFFFFF;
                        // Color is coded as RGB. convert to BGR
                        int b = colorValue & 0xff;
                        int g = (colorValue >> 8) & 0xff;
                        int r = (colorValue >> 0x10) & 0xff;
                        colorValue = (b << 0x10) + (g << 8) + r;
                    }

                    tempStr.Append(String.Format("{0,11}{1,11}", colorValue, fontDetail.Size)).Append(fontDetail.FontName);
                    commandList.Add(tempStr.ToString());
                }
                FontDetails.Clear();
                FontDetails = null; // once copied to Commandlist, clear the array
            }

            // recursive add sub nodes, if any
            foreach (TMemberNode node in Members)
            {
                if (node != null)
                {
                    node._AddToStringList(commandList);
                }
            }

            // close the member group
            Helper.AddCommand(commandList, TraceConst.CST_ADD_MEMBER);
        }