示例#1
0
 protected void SetRightIndent(Single value)
 {
     if (FRightIndent != value)
     {
         FRightIndent    = value;
         FRightIndentPix = HCUnitConversion.MillimeterToPixX(FRightIndent);
     }
 }
示例#2
0
        public void LoadFromStream(Stream aStream, ushort aFileVersion)
        {
            byte[] vBuffer;
            if (aFileVersion < 15)
            {
                int vLineSpace = 0;
                vBuffer = BitConverter.GetBytes(vLineSpace);
                aStream.Read(vBuffer, 0, vBuffer.Length);
            }

            byte vByte = 0;

            if (aFileVersion > 16)
            {
                vByte          = (byte)aStream.ReadByte();
                FLineSpaceMode = (ParaLineSpaceMode)vByte;
            }

            if (aFileVersion < 22)
            {
                vBuffer = BitConverter.GetBytes(FFirstIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndentPix = BitConverter.ToInt32(vBuffer, 0);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndentPix = BitConverter.ToInt32(vBuffer, 0);
            }
            else
            {
                vBuffer = BitConverter.GetBytes(FFirstIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndent    = BitConverter.ToSingle(vBuffer, 0);
                FFirstIndentPix = HCUnitConversion.MillimeterToPixX(FFirstIndent);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndent    = BitConverter.ToSingle(vBuffer, 0);
                FLeftIndentPix = HCUnitConversion.MillimeterToPixX(FLeftIndent);
                //
                vBuffer = BitConverter.GetBytes(FRightIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FRightIndent    = BitConverter.ToSingle(vBuffer, 0);
                FRightIndentPix = HCUnitConversion.MillimeterToPixX(FRightIndent);
            }

            //
            HC.HCLoadColorFromStream(aStream, ref FBackColor);
            //
            vByte      = (byte)aStream.ReadByte();
            FAlignHorz = (ParaAlignHorz)vByte;

            if (aFileVersion > 17)
            {
                vByte      = (byte)aStream.ReadByte();
                FAlignVert = (ParaAlignVert)vByte;
            }
        }
示例#3
0
        public HCEdit()
        {
            HCUnitConversion.Initialization();
            //this.DoubleBuffered = true;
            //Create();  // 便于子类在构造函数前执行
            FHCExtFormat = DataFormats.GetFormat(HC.HC_EXT);
            SetStyle(ControlStyles.Selectable, true);  // 可接收焦点

            FStyle = new HCStyle(true, true);

            FUndoList                  = new HCUndoList();
            FUndoList.OnUndo           = DoUndo;
            FUndoList.OnRedo           = DoRedo;
            FUndoList.OnUndoNew        = DoUndoNew;
            FUndoList.OnUndoGroupStart = DoUndoGroupBegin;
            FUndoList.OnUndoGroupEnd   = DoUndoGroupEnd;

            FData                      = new HCViewData(FStyle);
            FData.Width                = 200;
            FData.OnGetUndoList        = DoGetUndoList;
            FData.OnCreateItemByStyle  = DoDataCreateStyleItem;
            FData.OnDrawItemPaintBefor = DoDrawItemPaintBefor;
            FData.OnInsertItem         = DoDataInsertItem;
            FData.OnRemoveItem         = DoDataRemoveItem;

            // 垂直滚动条,范围在Resize中设置
            FVScrollBar             = new HCScrollBar();
            FVScrollBar.Orientation = Orientation.oriVertical;
            FVScrollBar.OnScroll    = DoVScrollChange;
            // 水平滚动条,范围在Resize中设置
            FHScrollBar             = new HCScrollBar();
            FHScrollBar.Orientation = Orientation.oriHorizontal;
            FHScrollBar.OnScroll    = DoVScrollChange;

            this.Controls.Add(FHScrollBar);
            this.Controls.Add(FVScrollBar);

            FChanged = false;
            this.ResumeLayout();
        }
示例#4
0
 protected void SetMarginBottom(Single value)
 {
     FMarginBottom    = value;
     FMarginBottomPix = HCUnitConversion.MillimeterToPixY(FMarginBottom);;
 }
示例#5
0
 protected void SetMarginRight(Single value)
 {
     FMarginRight    = value;
     FMarginRightPix = HCUnitConversion.MillimeterToPixX(FMarginRight);
 }
示例#6
0
 protected void SetMarginTop(Single value)
 {
     FMarginTop    = value;
     FMarginTopPix = HCUnitConversion.MillimeterToPixY(FMarginTop);
 }
示例#7
0
 protected void SetHeight(Single value)
 {
     FHeight    = value;
     FHeightPix = HCUnitConversion.MillimeterToPixY(FHeight);
 }
示例#8
0
 protected void SetWidth(Single value)
 {
     FWidth    = value;
     FWidthPix = HCUnitConversion.MillimeterToPixX(FWidth);
 }