public Padding GetMargins(IDeviceContext dc, MarginProperty prop) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid(prop, (int)prop, 0xe11, 0xe13)) { throw new InvalidEnumArgumentException("prop", (int)prop, typeof(MarginProperty)); } System.Windows.Forms.NativeMethods.MARGINS margins = new System.Windows.Forms.NativeMethods.MARGINS(); using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping)) { HandleRef hDC = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc); this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemeMargins(new HandleRef(this, this.Handle), hDC, this.part, this.state, (int)prop, ref margins); } return(new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight)); }
public Padding GetMargins(IDeviceContext dc, MarginProperty prop) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid(prop, (int) prop, 0xe11, 0xe13)) { throw new InvalidEnumArgumentException("prop", (int) prop, typeof(MarginProperty)); } System.Windows.Forms.NativeMethods.MARGINS margins = new System.Windows.Forms.NativeMethods.MARGINS(); using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping)) { HandleRef hDC = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc); this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemeMargins(new HandleRef(this, this.Handle), hDC, this.part, this.state, (int) prop, ref margins); } return new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); }
public static extern int GetThemeMargins(HandleRef hTheme, HandleRef hDC, int iPartId, int iStateId, int iPropId, ref System.Windows.Forms.NativeMethods.MARGINS margins);