Пример #1
0
        private RECT GetAreaRect(DateTimeArea aArea)
        {
            RECT Result = new RECT(0, 0, 0, 0);

            if (aArea == DateTimeArea.dtaNone)
            {
                return(Result);
            }

            //int vCharOffset = 0;
            //int vAppendLevel = 0;

            HCCanvas vCanvas = HCStyle.CreateStyleCanvas();

            try
            {
                this.OwnerData.Style.TextStyles[this.TextStyleNo].ApplyStyle(vCanvas);
                if (FFormat != "")
                {
                    AppendFormat(vCanvas, aArea, ref Result);
                }
                //else
                //    AppendFormat(ref Result, "C");  // 用短格式显示日期与时间
            }
            finally
            {
                HCStyle.DestroyStyleCanvas(vCanvas);
            }

            return(Result);
        }
Пример #2
0
        private void _FormatBreakTextDrawItem(int aItemNo, int aFmtLeft, int aFmtRight, ref int aDrawItemNo,
                                              ref POINT aPos, ref RECT vRect, ref int vRemainderWidth, ref bool vParaFirst)
        {
            HCCanvas vCanvas = HCStyle.CreateStyleCanvas();

            try
            {
                HCCustomDrawItem vDrawItem = DrawItems[aDrawItemNo];
                HCCustomItem     vItemBK   = Items[vDrawItem.ItemNo];
                int vLen = vItemBK.Text.Length;

                CalcItemFormatHeigh(vItemBK);

                int vWidth = Style.TempCanvas.TextWidth(vItemBK.Text[vLen - 1]);
                // 分裂前
                vDrawItem.CharLen    = vDrawItem.CharLen - 1;
                vDrawItem.Rect.Right = vDrawItem.Rect.Right - vWidth;
                vRemainderWidth      = aFmtRight - vDrawItem.Rect.Right;
                FinishLine(aItemNo, aDrawItemNo, vRemainderWidth);
                // 分裂后
                aPos.X       = aFmtLeft;
                aPos.Y       = vDrawItem.Rect.Bottom;
                vRect.Left   = aPos.X;
                vRect.Top    = aPos.Y;
                vRect.Right  = vRect.Left + vWidth;
                vRect.Bottom = vRect.Top + FItemFormatHeight;
                NewDrawItem(vDrawItem.ItemNo, vLen - 1, 1, vRect, false, true, ref aDrawItemNo);
                vParaFirst = false;
                aPos.X     = vRect.Right;

                vRemainderWidth = aFmtRight - vRect.Right;  // 放入最多后的剩余量
            }
            finally
            {
                HCStyle.DestroyStyleCanvas(vCanvas);
            }
        }