/// <summary>
        /// Method to create DISPLAYCONTROL_MONITOR_LAYOUT structure
        /// </summary>
        /// <param name="flags">A 32-bit unsigned integer that specifies monitor configuration flags.</param>
        /// <param name="left">A 32-bit signed integer that specifies the x-coordinate of the upper-left corner of the display monitor.</param>
        /// <param name="top">A 32-bit signed integer that specifies the y-coordinate of the upper-left corner of the display monitor.</param>
        /// <param name="width">A 32-bit unsigned integer that specifies the width of the monitor in pixels. </param>
        /// <param name="height">A 32-bit unsigned integer that specifies the height of the monitor in pixels. </param>
        /// <param name="physicalWidth">A 32-bit unsigned integer that specifies the physical width of the monitor, in millimeters (mm).</param>
        /// <param name="physicalHeight">A 32-bit unsigned integer that specifies the physical height of the monitor, in millimeters.</param>
        /// <param name="orientation">A 32-bit unsigned integer that specifies the orientation of the monitor in degrees.</param>
        /// <param name="desktopScaleFactor">A 32-bit, unsigned integer that specifies the desktop scale factor of the monitor.</param>
        /// <param name="deviceScaleFactor">A 32-bit, unsigned integer that specifies the device scale factor of the monitor. </param>
        /// <returns></returns>
        public DISPLAYCONTROL_MONITOR_LAYOUT createMonitorLayout(
            MonitorLayout_FlagValues flags,
            int left,
            int top,
            uint width,
            uint height,
            uint physicalWidth,
            uint physicalHeight,
            MonitorLayout_OrientationValues orientation,
            uint desktopScaleFactor,
            uint deviceScaleFactor)
        {
            DISPLAYCONTROL_MONITOR_LAYOUT monitorLayout = new DISPLAYCONTROL_MONITOR_LAYOUT();

            monitorLayout.Flags = flags;
            monitorLayout.Left  = left;
            monitorLayout.Top   = top;
            if (forceRestriction && width >= MinMonitorSize && width <= MaxMonitorSize && width % 2 == 0)
            {
                monitorLayout.Width = width;
            }
            else
            {
                return(null);
            }
            if (forceRestriction && height >= MinMonitorSize && height <= MaxMonitorSize)
            {
                monitorLayout.Height = height;
            }
            else
            {
                return(null);
            }
            monitorLayout.PhysicalWidth      = physicalWidth;
            monitorLayout.PhysicalHeight     = physicalHeight;
            monitorLayout.Orientation        = orientation;
            monitorLayout.DesktopScaleFactor = desktopScaleFactor;
            monitorLayout.DeviceScaleFactor  = desktopScaleFactor;
            return(monitorLayout);
        }
 /// <summary>
 /// Decode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to Decode the fields of this PDU.</param>
 /// <returns></returns>
 public bool Decode(PduMarshaler marshaler)
 {
     try
     {
         Flags              = (MonitorLayout_FlagValues)marshaler.ReadUInt32();
         Left               = marshaler.ReadInt32();
         Top                = marshaler.ReadInt32();
         Width              = marshaler.ReadUInt32();
         Height             = marshaler.ReadUInt32();
         PhysicalWidth      = marshaler.ReadUInt32();
         PhysicalHeight     = marshaler.ReadUInt32();
         Orientation        = (MonitorLayout_OrientationValues)marshaler.ReadUInt32();
         DesktopScaleFactor = marshaler.ReadUInt32();
         DeviceScaleFactor  = marshaler.ReadUInt32();
         return(true);
     }
     catch
     {
         marshaler.Reset();
         throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
     }
 }
 /// <summary>
 /// Decode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to Decode the fields of this PDU.</param>
 /// <returns></returns>
 public bool Decode(PduMarshaler marshaler)
 {
     try
     {
         Flags = (MonitorLayout_FlagValues)marshaler.ReadUInt32();
         Left = marshaler.ReadInt32();
         Top = marshaler.ReadInt32();
         Width = marshaler.ReadUInt32();
         Height = marshaler.ReadUInt32();
         PhysicalWidth = marshaler.ReadUInt32();
         PhysicalHeight = marshaler.ReadUInt32();
         Orientation = (MonitorLayout_OrientationValues)marshaler.ReadUInt32();
         DesktopScaleFactor = marshaler.ReadUInt32();
         DeviceScaleFactor = marshaler.ReadUInt32();
         return true;
     }
     catch
     {
         marshaler.Reset();
         throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
     }
 }