- 6 minutes to read
DirectX hardware acceleration allows your application to utilize a client machine's video card (integrated or dedicated) to render DevExpress controls. DirectX acceleration boosts applications' performance on 4K displays, where large data applications rendered with standard GDI+ can be unresponsive.
DirectX applications require the Windows 7 Platform Update (with DirectX 11), Windows 8 or newer. However, we do not recommend Windows 7 because the CreateSwapChainForHwnd method takes a DXGI_SWAP_CHAIN_DESC1
structure that has a field for Scaling. The DXGI_SCALING_NONE
Scaling is not supported on Windows 7 with the platform update. As a result, the CreateSwapChainForHwnd
method returns DXGI_ERROR_INVALID_CALL
when called. This causes the DirectX-rendered Data Grid to jitter when users resize the form.
Enable DirectX Hardware Acceleration
You can enable DirectX rendering in the DevExpress Project Settings window.
To enable DirectX rendering, you can also call the static WindowsFormsSettings.ForceDirectXPaint method when the application starts.
XamarinForms.CalendarControl ★39: Calendar control for Xamarin.Forms. XamarinForms.CancelableModal ★17: Close button for Xamarin.Forms modal page; Xamarin.Forms-Coordinator-Workaround ★14: A Xamarin.Forms (Android Only) Implementation of CoordinatorLayout with CollapsingToolbar. Jan 20, 2021 In this tutorial, you’ll extract CalendarControl, developed in Creating a Custom CalendarControl for iOS into a separate reusable framework. Along the way, you’ll: Create a new framework for CalendarControl. Migrate the existing code. Import everything back to the app. Build a binary framework, XCFramework. Pack it as an uber-portable Swift.
The ForceDirectXPaint method enables the DirectX hardware acceleration for the following controls:
- Editors when used for in-place data editing in Data Grid. The Rich Edit Control is not supported.
- Vertical Grid and Property Grid
To revert individual controls to the GDI+ engine, disable their UseDirectXPaint settings.
The following DevExpress controls' default UseDirectXPaint value is equal to DefaultBoolean.False. For these controls, calling the static WindowsFormsSettings.ForceDirectXPaint method alone has no effect. You should call the global static method and manually set their UseDirectXPaint properties to DefaultBoolean.True to enable the DirectX acceleration.
- CalendarControlBase descendants (for example, CalendarControl)
- TextEdit-based editors that support Advanced Mode (see the RepositoryItemTextEdit.UseAdvancedMode property).
To use DirectX rendering in the PDF Viewer control, enable the PdfViewer.RenderPageContentWithDirectX property.
Hardware Recommendations
Calendar Control 12.0
Displays
Applications benefit from DirectX acceleration on any display, but these advantages are more evident at higher resolutions (2K, WQHD, WQXGA, 4K, etc.).
Virtual Memory
Each control painted in DirectX mode requires its own DirectX device. You can set the optimal DirectX device number through the DevExpress.Utils.DirectXPaint.DirectXProvider.DeviceLimit property. If the current device number is equal to or higher than this DeviceLimit property value, new controls that need to be shown will still be painted with DirectX acceleration. However, the application tries to release devices for currently hidden controls to keep the number of active devices below the threshold, which reduces the total virtual memory consumption.
API Limitations
DirectX hardware acceleration imposes the following restrictions on the API:
Unsupported API | Recommended Action |
---|---|
All API accessed through the e.Graphics property (for example, when handling custom draw events). | Utilize the GraphicsCache class API (available through the e.Cache property).
|
Methods that use the Graphics class objects as parameters (for instance, the ControlPaint class methods). | No replacement, use similar methods instead. |
The AppearanceObject.CalcDefaultTextSize(Graphics g) method overload | Replace with the AppearanceObject.CalcDefaultTextSize(GraphicsCache cache) overload |
The following AppearanceObject.CalcTextSizeInt method overloads:
| Replace with the following overloads:
|
The following AppearanceObject.CalcTextSize method overloads:
| Replace with the following overloads:
|
The AppearanceObject.FontHeight property is obsolete | No replacement for this property. Revisit your code and use a different approach. |
The Pen.Alignment property is ignored. | There are no DirectX-compatible counterparts for this property. |
Custom fonts | Custom fonts that you use may be absent on users' machines. For that reason, use system fonts only. |
The InterpolationMode property in Graphics, GraphicsCache, and RepositoryItemPictureEdit classes supports only HighQualityBicubic and NearestNeighbor values. | |
CompositingMode, CompositingQuality, TextRenderingHint, SmoothingMode, and PixelOffsetMode properties in Graphics and GraphicsCache classes are ignored. |
Vb Calendar Control
To detect all the unsupported APIs, call the static WindowsFormsSettings.ForcePaintApiDiagnostics method and set the security level as the first parameter:
- Throw - unsupported APIs result in exceptions;
- Trace - unsupported APIs display result in warnings, displayed in Visual Studio's 'Output' window;
- Disable - ignores unsupported API;
- Default - acts as 'Trace' if DirectX andor Per-Monitor HiDPI support is enabled; otherwise, as 'Disable'.
The ForcePaintApiDiagnostics method's second parameter allows you to specify a custom behavior:
Test Mode
DevExpress DirectX rendering is available only for graphics cards that support Direct3D Feature Levels equal to or higher than 11. To check your GPU's supported Feature Levels, run the 'DirectX Diagnostic Tool': press 'Win+R' to launch the 'Run' dialog and type in the dxdiag command. Alternatively, in Visual Studio go to 'Help | About Microsoft Visual Studio' and click the 'DxDiag' button.
You can enable the Test Mode if your machine has Feature Levels of 10_2 or lower. This mode forces the application to use the DirectX rendering regardless of supported Feature Levels. Note that this mode is intended for debugging only.
You can also set the DirectXRenderLogMode property to RaiseDeviceCreationFailedEvent and handle the DeviceCreationFailed event to trace all cases when the application is unable to create a DirectX device.
-->A calendar enables a user to select a date by using a visual calendar display.
A Calendar control can be used on its own, or as a drop-down part of a DatePicker control. For more information, see DatePicker.
Fairfax Circuit Court Calendar Control
The following illustration shows two Calendar controls, one with selections and blackout dates and one without.
Calendar controls
The following table provides information about tasks that are typically associated with the Calendar.
Task | Implementation |
---|---|
Specify dates that cannot be selected. | Use the BlackoutDates property. |
Have the Calendar display a month, an entire year, or a decade. | Set the DisplayMode property to Month, Year, or Decade. |
Specify whether the user can select a date, a range of dates, or multiple ranges of dates. | Use the SelectionMode. |
Specify the range of dates that the Calendar displays. | Use the DisplayDateStart and DisplayDateEnd properties. |
Specify whether the current date is highlighted. | Use the IsTodayHighlighted property. By default, IsTodayHighlighted is true . |
Change the size of the Calendar. | Use a Viewbox or set the LayoutTransform property to a ScaleTransform. Note that if you set the Width and Height properties of a Calendar, the actual calendar does not change its size. |
The Calendar control provides basic navigation using either the mouse or keyboard. The following table summarizes keyboard navigation.
Key Combination | DisplayMode | Action |
---|---|---|
ARROW | Month | Changes the SelectedDate property if the SelectionMode property is not set to None. |
ARROW | Year | Changes the month of the DisplayDate property. Note that the SelectedDate does not change. |
ARROW | Decade | Changes the year of the DisplayDate. Note that the SelectedDate does not change. |
SHIFT+ARROW | Month | If SelectionMode is not set to SingleDate or None, extends the range of selected dates. |
HOME | Month | Changes the SelectedDate to the first day of the current month. |
HOME | Year | Changes the month of the DisplayDate to the first month of the year. The SelectedDate does not change. |
HOME | Decade | Changes the year of the DisplayDate to the first year of the decade. The SelectedDate does not change. |
END | Month | Changes the SelectedDate to the last day of the current month. |
END | Year | Changes the month of the DisplayDate to the last month of the year. The SelectedDate does not change. |
END | Decade | Changes the year of the DisplayDate to the last year of the decade. The SelectedDate does not change. |
CTRL+UP ARROW | Any | Switches to the next larger DisplayMode. If DisplayMode is already Decade, no action. |
CTRL+DOWN ARROW | Any | Switches to the next smaller DisplayMode. If DisplayMode is already Month, no action. |
SPACEBAR or ENTER | Year or Decade | Switches DisplayMode to the Month or Year represented by focused item. |