Exemple #1
0
 protected bool Equals(LabelPropMask other)
 {
     return(HasForeColor == other.HasForeColor && HasBackColor == other.HasBackColor && HasVariousPropertyBits == other.HasVariousPropertyBits &&
            HasCaption == other.HasCaption && HasPicturePosition == other.HasPicturePosition && HasSize == other.HasSize &&
            HasMousePointer == other.HasMousePointer && HasBorderColor == other.HasBorderColor && HasBorderStyle == other.HasBorderStyle &&
            HasSpecialEffect == other.HasSpecialEffect && HasPicture == other.HasPicture && HasAccelerator == other.HasAccelerator &&
            HasMouseIcon == other.HasMouseIcon);
 }
Exemple #2
0
        public LabelControl(byte[] b)
        {
            using (var st = new MemoryStream(b))
                using (var r = new FrxReader(st))
                {
                    MinorVersion = r.ReadByte();
                    MajorVersion = r.ReadByte();

                    var cbLabel = r.ReadUInt16();
                    PropMask = new LabelPropMask(r.ReadUInt32());

                    // DataBlock
                    ForeColor           = PropMask.HasForeColor ? r.ReadOleColor() : null;
                    BackColor           = PropMask.HasBackColor ? r.ReadOleColor() : null;
                    VariousPropertyBits = PropMask.HasVariousPropertyBits ? r.ReadUInt32() : 0;
                    var captionCcb = PropMask.HasCaption ? r.ReadCcb() : Tuple.Create(0, false);
                    PicturePosition = PropMask.HasPicturePosition ? r.ReadPicturePosition() : PicturePosition.RightTop;
                    MousePointer    = PropMask.HasMousePointer ? r.ReadMousePointer() : MousePointer.Default;
                    BorderColor     = PropMask.HasBorderColor ? r.ReadOleColor() : null;
                    BorderStyle     = PropMask.HasBorderStyle ? r.ReadBorderStyle() : BorderStyle.None;
                    SpecialEffect   = PropMask.HasSpecialEffect ? r.ReadSpecialEffect2() : SpecialEffect.Flat;
                    if (PropMask.HasPicture)
                    {
                        r.Skip2Bytes();
                    }

                    Accelerator = PropMask.HasAccelerator ? r.ReadWChar() : "";
                    if (PropMask.HasMouseIcon)
                    {
                        r.Skip2Bytes();
                    }

                    // ExtraDataBlock
                    Caption = r.ReadStringFromCcb(captionCcb);
                    Size    = PropMask.HasSize ? r.ReadCoords() : Tuple.Create(0, 0);

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

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