public HCTableCell(HCStyle AStyle) : this() { FCellData = new HCTableCellData(AStyle); FAlignVert = View.AlignVert.cavTop; FBorderSides = new HCBorderSides(); FBorderSides.InClude((byte)BorderSide.cbsLeft); FBorderSides.InClude((byte)BorderSide.cbsTop); FBorderSides.InClude((byte)BorderSide.cbsRight); FBorderSides.InClude((byte)BorderSide.cbsBottom); FBackgroundColor = AStyle.BackgroudColor; FRowSpan = 0; FColSpan = 0; }
public void LoadFromStream(Stream AStream, HCStyle AStyle, ushort AFileVersion) { byte[] vBuffer = BitConverter.GetBytes(FWidth); AStream.Read(vBuffer, 0, vBuffer.Length); FWidth = BitConverter.ToInt32(vBuffer, 0); vBuffer = BitConverter.GetBytes(FHeight); AStream.Read(vBuffer, 0, vBuffer.Length); FHeight = BitConverter.ToInt32(vBuffer, 0); vBuffer = BitConverter.GetBytes(FRowSpan); AStream.Read(vBuffer, 0, vBuffer.Length); FRowSpan = BitConverter.ToInt32(vBuffer, 0); vBuffer = BitConverter.GetBytes(FColSpan); AStream.Read(vBuffer, 0, vBuffer.Length); FColSpan = BitConverter.ToInt32(vBuffer, 0); if (AFileVersion > 11) { byte vByte = 0; vByte = (byte)AStream.ReadByte(); FAlignVert = (View.AlignVert)vByte; // 垂直对齐方式 HC.LoadColorFromStream(AStream, ref FBackgroundColor); // 背景色 } if (AFileVersion > 13) { FBorderSides.Value = (byte)AStream.ReadByte(); // load FBorderSides } bool vNullData = false; vBuffer = BitConverter.GetBytes(vNullData); AStream.Read(vBuffer, 0, vBuffer.Length); vNullData = BitConverter.ToBoolean(vBuffer, 0); if (!vNullData) { FCellData.LoadFromStream(AStream, AStyle, AFileVersion); FCellData.CellHeight = FHeight; } else { FCellData.Dispose(); FCellData = null; } }
public static StringFormat StringFormat(AlignHoriz h = AlignHoriz.center, AlignVert v = AlignVert.center) { StringFormat sf = new StringFormat(); switch (h) { case AlignHoriz.left: sf.Alignment = StringAlignment.Near; break; case AlignHoriz.right: sf.Alignment = StringAlignment.Far; break; case AlignHoriz.center: sf.Alignment = StringAlignment.Center; break; } switch (v) { case AlignVert.top: sf.LineAlignment = StringAlignment.Near; break; case AlignVert.bottom: sf.LineAlignment = StringAlignment.Far; break; case AlignVert.center: sf.LineAlignment = StringAlignment.Center; break; } return(sf); }