.Net comment traduire ce code en Windev (VB)

Posté par daniel le 30/3/2008 17:56:01
Bonjour,

je commence avec .net et j'ai besoin d'utiliser des assemblys pour pouvoir imprimer du HTML.

J'ai besoin d'utiliser .net pour contourner des limites de l'activeX Microsoft Web Browser et de ExecWB (impossibilité de paramétrer l'imprimante à a utiliser et les marges pour l'impression. Bien entendu sans afficher la boite de dialogue, et en évitant d'aller modifier les paramètres dans la BdR).

Je me retourne donc vers .Net qui devrait permettre de le faire.

Pour commencer voici le code que j'aimerais mettre sous Windev.

Nécessite System et System.Windows.Forms.


Private Sub PrintHelpPage()

    ' Create a WebBrowser instance. 
    Dim webBrowserForPrinting As New WebBrowser()

    ' Add an event handler that prints the document after it loads.
    AddHandler webBrowserForPrinting.DocumentCompleted, New _
        WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument)

    ' Set the Url property to load the document.
    webBrowserForPrinting.Url = New Uri("\\myshare\help.html")

End Sub

Private Sub PrintDocument(ByVal sender As Object, _
    ByVal e As WebBrowserDocumentCompletedEventArgs)

    Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser)

    ' Print the document now that it is fully loaded.
    webBrowserForPrinting.Print()
    MessageBox.Show("print")

    ' Dispose the WebBrowser now that the task is complete. 
    webBrowserForPrinting.Dispose()

End Sub


Merci, par avance

Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=19&topic_id=5793&post_id=23541