예제 #1
0
        public TabStripControl(byte[] b)
        {
            using (var st = new MemoryStream(b))
                using (var r = new FrxReader(st))
                {
                    MinorVersion = r.ReadByte();
                    MajorVersion = r.ReadByte();

                    var cbTabStrip = r.ReadUInt16();
                    PropMask = new TabStripPropMask(r.ReadUInt32());

                    // DataBlock
                    ListIndex = PropMask.HasListIndex ? r.ReadInt32() : 0;
                    BackColor = PropMask.HasBackColor ? r.ReadOleColor() : null;
                    ForeColor = PropMask.HasForeColor ? r.ReadOleColor() : null;
                    var itemsSize = PropMask.HasItems ? r.ReadUInt32() : 0;
                    MousePointer   = PropMask.HasMousePointer ? r.ReadMousePointer() : MousePointer.Arrow;
                    TabOrientation = PropMask.HasTabOrientation ? r.ReadUInt32() : 0;
                    TabStyle       = PropMask.HasTabStyle ? r.ReadUInt32() : 0;
                    TabFixedWidth  = PropMask.HasTabFixedWidth ? r.ReadUInt32() : 0;
                    TabFixedHeight = PropMask.HasTabFixedHeight ? r.ReadUInt32() : 0;
                    var tipStringsSize = PropMask.HasTipStrings ? r.ReadUInt32() : 0;
                    var namesSize      = PropMask.HasNames ? r.ReadUInt32() : 0;
                    VariousPropertyBits = PropMask.HasVariousPropertyBits ? r.ReadUInt32() : 0;
                    TabsAllocated       = PropMask.HasTabsAllocated ? r.ReadUInt32() : 0;
                    var tagsSize = PropMask.HasTags ? r.ReadUInt32() : 0;
                    TabData = PropMask.HasTabData ? r.ReadUInt32() : 0;
                    var acceleratorsSize = PropMask.HasAccelerator ? r.ReadUInt32() : 0;
                    if (PropMask.HasMouseIcon)
                    {
                        r.Skip2Bytes();
                    }

                    // ExtraDataBlock
                    Size         = PropMask.HasSize ? r.ReadCoords() : Tuple.Create(0, 0);
                    Items        = r.ReadArrayStrings(itemsSize);
                    TipStrings   = r.ReadArrayStrings(tipStringsSize);
                    TabNames     = r.ReadArrayStrings(namesSize);
                    Tags         = r.ReadArrayStrings(tagsSize);
                    Accelerators = r.ReadArrayStrings(acceleratorsSize);

                    r.AlignTo(4);
                    if (cbTabStrip != r.BaseStream.Position - 4)
                    {
                        throw new ApplicationException(string.Format(VBASyncResources.ErrorFrxStreamSizeMismatch,
                                                                     "o", "cbTabStrip", r.BaseStream.Position - 4, cbTabStrip));
                    }

                    // StreamData
                    MouseIcon = PropMask.HasMouseIcon ? r.ReadGuidAndPicture() : new byte[0];

                    TextProps = r.ReadTextProps();

                    Remainder = st.Position < st.Length ? r.Unaligned.ReadBytes((int)(st.Length - st.Position)) : new byte[0];
                }
        }
예제 #2
0
 protected bool Equals(TabStripPropMask other)
 {
     return(HasAccelerator == other.HasAccelerator && HasBackColor == other.HasBackColor && HasForeColor == other.HasForeColor &&
            HasItems == other.HasItems && HasListIndex == other.HasListIndex && HasMouseIcon == other.HasMouseIcon &&
            HasMousePointer == other.HasMousePointer && HasMultiRow == other.HasMultiRow && HasNames == other.HasNames &&
            HasNewVersion == other.HasNewVersion && HasSize == other.HasSize && HasTabData == other.HasTabData &&
            HasTabFixedHeight == other.HasTabFixedHeight && HasTabFixedWidth == other.HasTabFixedWidth &&
            HasTabOrientation == other.HasTabOrientation && HasTabsAllocated == other.HasTabsAllocated && HasTags == other.HasTags &&
            HasTipStrings == other.HasTipStrings && HasTooltips == other.HasTooltips &&
            HasVariousPropertyBits == other.HasVariousPropertyBits);
 }