/// <summary> /// [See win32 equivalent.] /// </summary> public Size GetPartSize(IDeviceContext dc, ThemeSizeType type) { ArgumentNullException.ThrowIfNull(dc); using var hdc = new DeviceContextHdcScope(dc); return(GetPartSize(hdc, type, IntPtr.Zero)); }
internal unsafe Size GetPartSize(IDeviceContext dc, ThemeSizeType type, IntPtr hWnd) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } // valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); if (DpiHelper.IsPerMonitorV2Awareness && hWnd != IntPtr.Zero) { using (ThemeHandle hTheme = ThemeHandle.Create(_class, true, hWnd) !) { lastHResult = GetThemePartSize(new HandleRef(this, hTheme.Handle), hdc, part, state, null, type, out Size dpiSize); return(dpiSize); } } lastHResult = GetThemePartSize(this, hdc, part, state, null, type, out Size size); return(size); }
internal Size GetPartSize(IDeviceContext dc, ThemeSizeType type, IntPtr hWnd) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } // valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } NativeMethods.SIZE size = new NativeMethods.SIZE(); using (WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties)) { HandleRef hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); if (DpiHelper.IsPerMonitorV2Awareness && (IntPtr.Zero != hWnd)) { using (ThemeHandle hTheme = ThemeHandle.Create(_class, true, new HandleRef(null, hWnd))) { lastHResult = SafeNativeMethods.GetThemePartSize(new HandleRef(this, hTheme.NativeHandle), hdc, part, state, null, type, size); } } else { lastHResult = SafeNativeMethods.GetThemePartSize(new HandleRef(this, Handle), hdc, part, state, null, type, size); } } return(new Size(size.cx, size.cy)); }
public static extern int GetThemePartSize( IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, IntPtr rect, ThemeSizeType eSize, [Out] NativeMethods.SIZE psz);
public unsafe static extern HRESULT GetThemePartSize( IntPtr hTheme, Gdi32.HDC hdc, int iPartId, int iStateId, RECT *prc, ThemeSizeType eSize, out Size psz);
/// <summary> /// [See win32 equivalent.] /// </summary> public Size GetPartSize(IDeviceContext dc, ThemeSizeType type) { if (dc is null) { throw new ArgumentNullException(nameof(dc)); } using var hdc = new DeviceContextHdcScope(dc); return(GetPartSize(hdc, type, IntPtr.Zero)); }
/// <summary> /// [See win32 equivalent.] /// </summary> public unsafe Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { ArgumentNullException.ThrowIfNull(dc); // Valid values are 0x0 to 0x2 SourceGenerated.EnumValidator.Validate(type, nameof(type)); using var hdc = new DeviceContextHdcScope(dc); RECT boundsRect = bounds; _lastHResult = GetThemePartSize(this, hdc, Part, State, &boundsRect, type, out Size size); return(size); }
public Size GetPartPreferredSize(Graphics g, Rectangle bounds, ThemeSizeType type) { if (this.currentElement == null || this.currentHTheme == IntPtr.Zero) { return(Size.Empty); } RadHdcWrapper radHdcWrapper = new RadHdcWrapper(g, false); IntPtr hdc = radHdcWrapper.GetHdc(); NativeMethods.SIZE psz = new NativeMethods.SIZE(); UXTheme.GetThemePartSize(this.currentHTheme, hdc, this.currentElement.Part, this.currentElement.State, IntPtr.Zero, type, psz); radHdcWrapper.Dispose(); return(new Size(psz.cx, psz.cy)); }
public unsafe static HRESULT GetThemePartSize( IHandle hTheme, Gdi32.HDC hdc, int iPartId, int iStateId, RECT *prc, ThemeSizeType eSize, out Size psz) { HRESULT hr = GetThemePartSize(hTheme.Handle, hdc, iPartId, iStateId, prc, eSize, out psz); GC.KeepAlive(hTheme); return(hr); }
public Size_ GetPartSize(IDeviceContext dc, ThemeSizeType type) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!Enum.IsDefined(typeof(ThemeSizeType), type)) { throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)type, typeof(ThemeSizeType)); } Size_ result; last_hresult = VisualStyles.UxThemeGetThemePartSize(theme, dc, this.part, this.state, type, out result); return(result); }
internal unsafe Size GetPartSize(Gdi32.HDC dc, ThemeSizeType type, IntPtr hWnd = default) { // Valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } if (DpiHelper.IsPerMonitorV2Awareness && hWnd != IntPtr.Zero) { using ThemeHandle hTheme = ThemeHandle.Create(Class, true, hWnd) !; _lastHResult = GetThemePartSize(hTheme, dc, Part, State, null, type, out Size dpiSize); return(dpiSize); } _lastHResult = GetThemePartSize(this, dc, Part, State, null, type, out Size size); return(size); }
public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid(type, (int)type, 0, 2)) { throw new InvalidEnumArgumentException("type", (int)type, typeof(ThemeSizeType)); } System.Windows.Forms.NativeMethods.SIZE psz = new System.Windows.Forms.NativeMethods.SIZE(); 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.GetThemePartSize(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), type, psz); } return(new Size(psz.cx, psz.cy)); }
/// <summary> /// [See win32 equivalent.] /// </summary> public unsafe Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if (dc is null) { throw new ArgumentNullException(nameof(dc)); } // Valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } using var hdc = new DeviceContextHdcScope(dc); RECT boundsRect = bounds; _lastHResult = GetThemePartSize(this, hdc, Part, State, &boundsRect, type, out Size size); return(size); }
internal unsafe Size GetPartSize(Gdi32.HDC dc, ThemeSizeType type, IntPtr hwnd = default) { // Valid values are 0x0 to 0x2 SourceGenerated.EnumValidator.Validate(type, nameof(type)); if (DpiHelper.IsPerMonitorV2Awareness && hwnd != IntPtr.Zero) { using var htheme = new UxTheme.OpenThemeDataScope(hwnd, Class); if (htheme.IsNull) { throw new InvalidOperationException(SR.VisualStyleHandleCreationFailed); } _lastHResult = GetThemePartSize(htheme, dc, Part, State, null, type, out Size dpiSize); return(dpiSize); } _lastHResult = GetThemePartSize(this, dc, Part, State, null, type, out Size size); return(size); }
public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } //valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } using (WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties)) { HandleRef hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); lastHResult = SafeNativeMethods.GetThemePartSize(new HandleRef(this, Handle), hdc, part, state, new NativeMethods.COMRECT(bounds), type, out Size size); return(size); } }
/// <summary> /// [See win32 equivalent.] /// </summary> public unsafe Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } //valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); RECT boundsRect = bounds; lastHResult = GetThemePartSize(this, hdc, part, state, &boundsRect, type, out Size size); return(size); }
internal unsafe Size GetPartSize(Gdi32.HDC dc, ThemeSizeType type, IntPtr hwnd = default) { // Valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ThemeSizeType)); } if (DpiHelper.IsPerMonitorV2Awareness && hwnd != IntPtr.Zero) { using var htheme = new UxTheme.OpenThemeDataScope(hwnd, Class); if (htheme.IsNull) { throw new InvalidOperationException(SR.VisualStyleHandleCreationFailed); } _lastHResult = GetThemePartSize(htheme, dc, Part, State, null, type, out Size dpiSize); return(dpiSize); } _lastHResult = GetThemePartSize(this, dc, Part, State, null, type, out Size size); return(size); }
public System.Drawing.Size GetPartSize(System.Drawing.IDeviceContext dc, ThemeSizeType type) { }
public System.Drawing.Size GetPartSize(System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, ThemeSizeType type) { }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.GetPartSize1"]/*' /> /// <devdoc> /// <para> /// [See win32 equivalent.] /// </para> /// </devdoc> public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if( dc == null ){ throw new ArgumentNullException("dc"); } //valid values are 0x0 to 0x2 if (!ClientUtils.IsEnumValid(type, (int)type, (int)ThemeSizeType.Minimum, (int)ThemeSizeType.Draw)) { throw new InvalidEnumArgumentException("type", (int)type, typeof(ThemeSizeType)); } NativeMethods.SIZE size = new NativeMethods.SIZE(); using( WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper( dc, AllGraphicsProperties ) ) { HandleRef hdc = new HandleRef( wgr, wgr.WindowsGraphics.DeviceContext.Hdc ); lastHResult = SafeNativeMethods.GetThemePartSize( new HandleRef( this, Handle ), hdc, part, state, new NativeMethods.COMRECT( bounds ), type, size ); } return new Size(size.cx, size.cy); }
public Size GetPartSize(IDeviceContext dc, ThemeSizeType type) { throw null; }
public static extern int GetThemePartSize(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, [In] NativeMethodsR.COMRECT prc, ThemeSizeType eSize, [Out] NativeMethodsR.SIZE psz);
public int UxThemeGetThemePartSize(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle_ bounds, ThemeSizeType type, out Size_ result) { XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle(bounds); UXTheme.SIZE retval; int hresult = UXTheme.GetThemePartSize(hTheme, dc.GetHdc(), iPartId, iStateId, ref BoundsRect, (int)type, out retval); dc.ReleaseHdc(); result = retval.ToSize(); return(hresult); }
public int UxThemeGetThemePartSize (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, ThemeSizeType type, out Size result) { UXTheme.SIZE retval; int hresult = UXTheme.GetThemePartSize (hTheme, dc.GetHdc (), iPartId, iStateId, IntPtr.Zero, (int)type, out retval); dc.ReleaseHdc (); result = retval.ToSize (); return hresult; }
public int UxThemeGetThemePartSize (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle bounds, ThemeSizeType type, out Size result) { XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds); UXTheme.SIZE retval; int hresult = UXTheme.GetThemePartSize (hTheme, dc.GetHdc (), iPartId, iStateId, ref BoundsRect, (int)type, out retval); dc.ReleaseHdc (); result = retval.ToSize(); return hresult; }
public Size GetPartSize (IDeviceContext dc, ThemeSizeType type) { if (dc == null) throw new ArgumentNullException ("dc"); if (!Enum.IsDefined (typeof (ThemeSizeType), type)) throw new System.ComponentModel.InvalidEnumArgumentException ("prop", (int)type, typeof (ThemeSizeType)); Size result; last_hresult = VisualStyles.UxThemeGetThemePartSize (theme, dc, this.part, this.state, type, out result); return result; }
public static extern int GetThemePartSize(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, [In] System.Windows.Forms.NativeMethods.COMRECT prc, ThemeSizeType eSize, [Out] System.Windows.Forms.NativeMethods.SIZE psz);
public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { throw null; }
public int UxThemeGetThemePartSize(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, ThemeSizeType type, out Size result) => throw new InvalidOperationException();
/// <summary> /// [See win32 equivalent.] /// </summary> public Size GetPartSize(IDeviceContext dc, ThemeSizeType type) { return(GetPartSize(dc, type, IntPtr.Zero)); }
public int UxThemeGetThemePartSize(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, ThemeSizeType type, out Size_ result) { UXTheme.SIZE retval; int hresult = UXTheme.GetThemePartSize(hTheme, dc.GetHdc(), iPartId, iStateId, IntPtr.Zero, (int)type, out retval); dc.ReleaseHdc(); result = retval.ToSize(); return(hresult); }
public int UxThemeGetThemePartSize (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, ThemeSizeType type, out Size result) { return (int)(GetPartSize ((ThemeHandle)(int)hTheme, dc, iPartId, iStateId, Rectangle.Empty, false, type, out result) ? S.S_OK : S.S_FALSE); }
public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid(type, (int) type, 0, 2)) { throw new InvalidEnumArgumentException("type", (int) type, typeof(ThemeSizeType)); } System.Windows.Forms.NativeMethods.SIZE psz = new System.Windows.Forms.NativeMethods.SIZE(); 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.GetThemePartSize(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), type, psz); } return new Size(psz.cx, psz.cy); }
public unsafe static HRESULT GetThemePartSize(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, RECT *prc, ThemeSizeType eSize, out Size psz) { HRESULT hr = GetThemePartSize(hTheme.Handle, hdc.Handle, iPartId, iStateId, prc, eSize, out psz); GC.KeepAlive(hTheme.Wrapper); GC.KeepAlive(hdc.Wrapper); return(hr); }
bool GetPartSize (ThemeHandle themeHandle, IDeviceContext dc, int part, int state, Rectangle bounds, bool rectangleSpecified, ThemeSizeType type, out Size result) { switch (themeHandle) { #region BUTTON case ThemeHandle.BUTTON: switch ((BUTTONPARTS)part) { case BUTTONPARTS.BP_RADIOBUTTON: result = GtkPlus.RadioButtonGetSize (); return true; case BUTTONPARTS.BP_CHECKBOX: result = GtkPlus.CheckBoxGetSize (); return true; } break; #endregion #region HEADER case ThemeHandle.HEADER: switch ((HEADERPARTS)part) { case HEADERPARTS.HP_HEADERITEM: result = new Size (0, ThemeWin32Classic.ListViewGetHeaderHeight ()); return true; } break; #endregion #region TRACKBAR case ThemeHandle.TRACKBAR: switch ((TRACKBARPARTS)part) { case TRACKBARPARTS.TKP_TRACK: result = new Size (0, ThemeWin32Classic.TrackBarHorizontalTrackHeight); return true; case TRACKBARPARTS.TKP_TRACKVERT: result = new Size (ThemeWin32Classic.TrackBarVerticalTrackWidth, 0); return true; case TRACKBARPARTS.TKP_THUMB: case TRACKBARPARTS.TKP_THUMBVERT: result = ThemeWin32Classic.TrackBarGetThumbSize (); if ((TRACKBARPARTS)part == TRACKBARPARTS.TKP_THUMBVERT) { int temporary = result.Width; result.Width = result.Height; result.Height = temporary; } return true; } break; #endregion } result = Size.Empty; return false; }