Пример #1
0
        public virtual bool LoadFromStream(Stream stream)
        {
            FStyle.States.Include(HCState.hosLoading);
            try
            {
                stream.Position = 0;
                LoadSectionProcHandler vEvent = delegate(ushort aFileVersion)
                {
                    byte vByte = 0;
                    vByte = (byte)stream.ReadByte();  // 节数量
                    // 各节数据
                    FSections[0].LoadFromStream(stream, FStyle, aFileVersion);
                    for (int i = 1; i <= vByte - 1; i++)
                    {
                        HCSection vSection = NewDefaultSection();
                        vSection.LoadFromStream(stream, FStyle, aFileVersion);
                        FSections.Add(vSection);
                    }
                };

                DoLoadFromStream(stream, FStyle, vEvent);
            }
            finally
            {
                FStyle.States.Exclude(HCState.hosLoading);
            }

            return(true);
        }
Пример #2
0
 private void DoInsertDeItem(HCEmrView aEmrView, HCSection aSection, HCCustomData aData, HCCustomItem aItem)
 {
     if (aItem is DeCombobox)
     {
         (aItem as DeCombobox).OnPopupItem = DoRecordDeComboboxGetItem;
     }
 }
Пример #3
0
        private HCSection NewDefaultSection()
        {
            HCSection Result = new HCSection(FStyle);

            Result.OnPaintFooterAfter  = DoSectionPaintFooterAfter;
            Result.OnCreateItemByStyle = DoSectionCreateStyleItem;
            return(Result);
        }
Пример #4
0
        public bool LoadFromXmlStream(Stream stream)
        {
            XmlDocument vXml = new XmlDocument();

            vXml.PreserveWhitespace = true;
            vXml.Load(stream);
            if (vXml.DocumentElement.Name == "HCView")
            {
                if (vXml.DocumentElement.Attributes["EXT"].Value != HC.HC_EXT)
                {
                    return(false);
                }

                string vVersion = vXml.DocumentElement.Attributes["ver"].Value;
                byte   vLang    = byte.Parse(vXml.DocumentElement.Attributes["lang"].Value);

                FStyle.States.Include(HCState.hosLoading);
                try
                {
                    for (int i = 0; i <= vXml.DocumentElement.ChildNodes.Count - 1; i++)
                    {
                        XmlElement vNode = vXml.DocumentElement.ChildNodes[i] as XmlElement;
                        if (vNode.Name == "style")
                        {
                            FStyle.ParseXml(vNode);
                        }
                        else
                        if (vNode.Name == "sections")
                        {
                            FSections[0].ParseXml(vNode.ChildNodes[0] as XmlElement);
                            for (int j = 1; j < vNode.ChildNodes.Count - 1; j++)
                            {
                                HCSection vSection = NewDefaultSection();
                                vSection.ParseXml(vNode.ChildNodes[j] as XmlElement);
                                FSections.Add(vSection);
                            }
                        }
                    }
                }
                finally
                {
                    FStyle.States.Exclude(HCState.hosLoading);
                }

                return(true);
            }

            return(false);
        }
Пример #5
0
        protected void DoSectionPaintFooterAfter(object sender, int pageIndex, RECT rect, HCCanvas canvas, SectionPaintInfo paintInfo)
        {
            HCSection vSection = sender as HCSection;

            if (vSection.PageNoVisible)
            {
                int vSectionIndex          = FSections.IndexOf(vSection);
                int vSectionStartPageIndex = 0;
                int vAllPageCount          = 0;
                for (int i = 0; i <= FSections.Count - 1; i++)
                {
                    if (i == vSectionIndex)
                    {
                        vSectionStartPageIndex = vAllPageCount;
                    }

                    vAllPageCount = vAllPageCount + FSections[i].PageCount;
                }

                string vS = string.Format(vSection.PageNoFormat, vSectionStartPageIndex + vSection.PageNoFrom + pageIndex, vAllPageCount);
                canvas.Brush.Style = HCBrushStyle.bsClear;

                canvas.Font.BeginUpdate();
                try
                {
                    canvas.Font.Size   = 10;
                    canvas.Font.Family = "宋体";
                }
                finally
                {
                    canvas.Font.EndUpdate();
                }

                canvas.TextOut(rect.Left + (rect.Width - canvas.TextWidth(vS)) / 2, rect.Top + vSection.Footer.Height, vS);
            }
        }