can not use direct2d in winui3?

mc 6,416 Reputation points
2023-11-29T07:54:03.7233333+00:00
m_pRenderTarget->BeginDraw();
m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());
m_pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::DeepSkyBlue));
m_pRenderTarget->EndDraw();

in winform I can get the result.

User's image

but in winui3 nothing changed why?

Windows development | Windows App SDK
0 comments No comments
{count} votes

Answer accepted by question author
  1. Castorix31 91,506 Reputation points
    2023-11-29T08:49:20.41+00:00

    See the sample I had posted : https://github.com/castorix/WinUI3_SwapChainPanel_Direct2D

    The drawing is done in Render function, called in CompositionTarget_Rendering

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.