共用方式為


VsShellUtilities.GetDpiContext Method

Definition

Overloads

GetDpiContext(Object)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns System awareness.

GetDpiContext(Object, DpiAwarenessContext)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns the given default context.

GetDpiContext(Object)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns System awareness.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Utilities::DpiAwarenessContext GetDpiContext(System::Object ^ obj);
public static Microsoft.VisualStudio.Utilities.DpiAwarenessContext GetDpiContext (this object obj);
static member GetDpiContext : obj -> Microsoft.VisualStudio.Utilities.DpiAwarenessContext
<Extension()>
Public Function GetDpiContext (obj As Object) As DpiAwarenessContext

Parameters

obj
Object

Returns

Remarks

WPF content doesn't need to implement this interface, it's only needed for non-WPF UI. Additionally, since all non-WPF UI needs to do some work to support PerMonitor awareness, the fallback needs to be System awareness or else UI bugs can occur.

Applies to

GetDpiContext(Object, DpiAwarenessContext)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns the given default context.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Utilities::DpiAwarenessContext GetDpiContext(System::Object ^ obj, Microsoft::VisualStudio::Utilities::DpiAwarenessContext defaultContext);
public static Microsoft.VisualStudio.Utilities.DpiAwarenessContext GetDpiContext (this object obj, Microsoft.VisualStudio.Utilities.DpiAwarenessContext defaultContext);
static member GetDpiContext : obj * Microsoft.VisualStudio.Utilities.DpiAwarenessContext -> Microsoft.VisualStudio.Utilities.DpiAwarenessContext
<Extension()>
Public Function GetDpiContext (obj As Object, defaultContext As DpiAwarenessContext) As DpiAwarenessContext

Parameters

obj
Object
defaultContext
DpiAwarenessContext

Returns

Remarks

WPF content doesn't need to implement this interface, it's only needed for non-WPF UI. Additionally, since all non-WPF UI needs to do some work to support PerMonitor awareness, the fallback needs to be System awareness or else UI bugs can occur.

Applies to