LeandroA, do my examples work?
Code:' // DirectWrite basic drawing example Option Explicit Dim cD2dFactory As ID2D1Factory Dim cDWFactory As IDWriteFactory Dim cTarget As ID2D1HwndRenderTarget Dim cTextFormat As IDWriteTextFormat Dim cBrush As ID2D1Brush Private Sub Form_Load() Set cD2dFactory = D2D1.CreateFactory Set cTarget = cD2dFactory.CreateHwndRenderTarget(D2D1.RenderTargetProperties( _ D2D1.PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM)), _ D2D1.HwndRenderTargetProperties(Me.hWnd, D2D1.SizeU)) Set cDWFactory = DW.CreateFactory(DWRITE_FACTORY_TYPE_SHARED) ' // Create text format Set cTextFormat = cDWFactory.CreateTextFormat("Arial", Nothing, DWRITE_FONT_WEIGHT_NORMAL, _ DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, _ 19# * 96# / 72#, "en-US") ' // Color brush Set cBrush = cTarget.CreateSolidColorBrush(D2D1.ColorF(Red), ByVal 0&) End Sub Private Sub Form_Paint() Dim sText As String sText = "Hello World!" cTarget.BeginDraw cTarget.Clear D2D1.ColorF(Ivory) cTarget.DrawText sText, Len(sText), ByVal cTextFormat, D2D1.RectF(20, 20, 220, 120), cBrush cTarget.EndDraw ByVal 0&, ByVal 0& End Sub Private Sub Form_Resize() cTarget.Resize D2D1.SizeU(Me.ScaleWidth, Me.ScaleHeight) End SubIf you need something about d2dvb.tlb or dwvb.tlb you can write to the related thread.Code:' // Create WIC bitmap that is saved to file Set cBitmap = cWicFactory.CreateBitmap(Me.ScaleWidth, Me.ScaleHeight, _ WIC.GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnLoad) ' // Create render target based on that image Set cBitmapSurf = cFactory.CreateWicBitmapRenderTarget(cBitmap, D2D1.RenderTargetProperties( _ D2D1.PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED), _ D2D1_RENDER_TARGET_TYPE_SOFTWARE, 96, 96, D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE)) DrawButtons cBitmapSurf




Reply With Quote