public static System.Windows.Forms.Padding GetMargins2(this VisualStyleRenderer rnd, IDeviceContext dc, MarginProperty prop) { NativeMethods.RECT rc; using (SafeGDIHandle hdc = new SafeGDIHandle(dc)) NativeMethods.GetThemeMargins(rnd.Handle, hdc, rnd.Part, rnd.State, (int)prop, IntPtr.Zero, out rc); return new System.Windows.Forms.Padding(rc.Left, rc.Top, rc.Right, rc.Bottom); }
public StyleBase() { Width = new WidthProperty(); Height= new HeightProperty(); Padding = new PaddingProperty(); Margin = new MarginProperty(); FontSize = new FontSizeProperty(); Color=string.Empty; BackgroundColor=string.Empty; Hidden=false; }
/// <summary> /// [See win32 equivalent.] /// </summary> public unsafe Padding GetMargins(IDeviceContext dc, MarginProperty prop) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } //valid values are 0xe11 to 0xe13 if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)MarginProperty.SizingMargins, (int)MarginProperty.CaptionMargins)) { throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(MarginProperty)); } using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); lastHResult = GetThemeMargins(this, hdc, part, state, (int)prop, null, out MARGINS 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(nameof(dc)); } //valid values are 0xe11 to 0xe13 if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)MarginProperty.SizingMargins, (int)MarginProperty.CaptionMargins)) { throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(MarginProperty)); } UxTheme.MARGINS margins = default; using (WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties)) { HandleRef hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); lastHResult = SafeNativeMethods.GetThemeMargins(new HandleRef(this, Handle), hdc, part, state, (int)prop, prc: null, ref margins); } return(new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight)); }
public int UxThemeGetThemeMargins(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result) => throw new InvalidOperationException();
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors /// <summary> /// Static ctor. Initializes property metadata. /// </summary> static Table() { MarginProperty.OverrideMetadata(typeof(Table), new FrameworkPropertyMetadata(new Thickness(Double.NaN))); }
public int UxThemeGetThemeMargins(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result) { UXTheme.MARGINS retval = new UXTheme.MARGINS(); XplatUIWin32.RECT BoundsRect; int hresult = UXTheme.GetThemeMargins(hTheme, dc.GetHdc(), iPartId, iStateId, (int)prop, out BoundsRect, out retval); dc.ReleaseHdc(); result = retval.ToPadding(); return(hresult); }
public static System.Windows.Forms.Padding GetMargins2(this VisualStyleRenderer rnd, IDeviceContext dc, MarginProperty prop) { NativeMethods.RECT rc; using (SafeGDIHandle hdc = new SafeGDIHandle(dc)) NativeMethods.GetThemeMargins(rnd.Handle, hdc, rnd.Part, rnd.State, (int)prop, IntPtr.Zero, out rc); return(new System.Windows.Forms.Padding(rc.Left, rc.Top, rc.Right, rc.Bottom)); }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.GetMargins"]/*' /> /// <devdoc> /// <para> /// [See win32 equivalent.] /// </para> /// </devdoc> public Padding GetMargins(IDeviceContext dc, MarginProperty prop) { if( dc == null ){ throw new ArgumentNullException("dc"); } //valid values are 0xe11 to 0xe13 if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)MarginProperty.SizingMargins, (int)MarginProperty.CaptionMargins)) { throw new InvalidEnumArgumentException("prop", (int)prop, typeof(MarginProperty)); } NativeMethods.MARGINS margins = new NativeMethods.MARGINS(); using( WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper( dc, AllGraphicsProperties ) ) { HandleRef hdc = new HandleRef( wgr, wgr.WindowsGraphics.DeviceContext.Hdc ); lastHResult = SafeNativeMethods.GetThemeMargins( new HandleRef( this, Handle ), hdc, part, state, (int) prop, ref margins ); } return new Padding(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); }
private Padding GetMargins(IDeviceContext ctxt, MarginProperty type, VisualStyleRenderer renderer) { return(GetMargins(ctxt, type, renderer.Handle, renderer.Part, renderer.State)); }
public int UxThemeGetThemeMargins (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result) { result = Padding.Empty; return (int)S.S_FALSE; }
set => SetValue(MarginProperty, value);
public System.Windows.Forms.Padding GetMargins(System.Drawing.IDeviceContext dc, MarginProperty prop) { }
static LayoutItem() { ToolTipProperty.OverrideMetadata(typeof(LayoutItem), new FrameworkPropertyMetadata(null, (s, e) => OnToolTipChanged(s, e))); VisibilityProperty.OverrideMetadata(typeof(LayoutItem), new FrameworkPropertyMetadata(Visibility.Visible, (s, e) => OnVisibilityChanged(s, e))); MarginProperty.OverrideMetadata(typeof(LayoutItem), new FrameworkPropertyMetadata(new Thickness(0), (s, e) => OnMarginChanged(s, e))); }
static OptionPanel() { MarginProperty.OverrideMetadata(typeof(OptionPanel), new FrameworkPropertyMetadata(new Thickness(2, 0, 4, 0))); }
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); }
private Padding GetThemeMargins(IDeviceContext dc, MarginProperty marginType) { NativeMethods.MARGINS margins; try { var hDC = dc.GetHdc(); var rv = NativeMethods.GetThemeMargins( renderer.Handle, hDC, renderer.Part, renderer.State, (int)marginType, IntPtr.Zero, out margins); if (rv == 0) { return new Padding( margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); } return new Padding(0); } catch (Exception) { return renderer.GetMargins(dc, marginType); } finally { dc.ReleaseHdc(); } }
public Padding GetMargins(IDeviceContext dc, MarginProperty prop) { throw null; }
/// <summary>Retrieves the value of a <c>MARGINS</c> property.</summary> /// <param name="rnd">The visual style to query.</param> /// <param name="dc">A device context for any font selection. This value can be <see langword="null"/>.</param> /// <param name="prop">The property to retrieve.</param> /// <returns>The margins defined for the property.</returns> public static Padding GetMargins2(this VisualStyleRenderer rnd, IDeviceContext dc = null, MarginProperty prop = MarginProperty.ContentMargins) { using (var hdc = new SafeHDC(dc)) { GetThemeMargins(rnd.GetSafeHandle(), hdc, rnd.Part, rnd.State, (int)prop, null, out MARGINS m); return(new Padding(m.cxLeftWidth, m.cyTopHeight, m.cxRightWidth, m.cyBottomHeight)); } }
public Padding GetMargins (IDeviceContext dc, MarginProperty prop) { if (dc == null) throw new ArgumentNullException ("dc"); if (!Enum.IsDefined (typeof (MarginProperty), prop)) throw new System.ComponentModel.InvalidEnumArgumentException ("prop", (int)prop, typeof (MarginProperty)); Padding result; last_hresult = VisualStyles.UxThemeGetThemeMargins (theme, dc, this.part, this.state, prop, out result); return result; }
public static Padding GetMargins2(this VisualStyleRenderer rnd, IDeviceContext dc = null, MarginProperty prop = MarginProperty.ContentMargins) { NativeMethods.RECT rc; using (var hdc = new NativeMethods.SafeDCHandle(dc)) NativeMethods.GetThemeMargins(rnd, hdc, rnd.Part, rnd.State, (int)prop, IntPtr.Zero, out rc); return(new Padding(rc.Left, rc.Top, rc.Right, rc.Bottom)); }
public int UxThemeGetThemeMargins (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, MarginProperty prop, out Padding result) { UXTheme.MARGINS retval = new UXTheme.MARGINS (); XplatUIWin32.RECT BoundsRect; int hresult = UXTheme.GetThemeMargins (hTheme, dc.GetHdc (), iPartId, iStateId, (int)prop, out BoundsRect, out retval); dc.ReleaseHdc (); result = retval.ToPadding(); return hresult; }
// *** Constructors *** static ShadowChrome() { MarginProperty.OverrideMetadata(typeof(ShadowChrome), new FrameworkPropertyMetadata(new Thickness(0, 0, 4, 4))); CreateBrushes(); }
/// <summary> /// Initialises static members of the <see cref="Window"/> class. /// </summary> static Window() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window))); MarginProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnMarginPropertyChanged))); }