Platforms to show: All Mac Windows Linux Cross-Platform

/Win/HTMLViewer Windows/HTMLViewer Image


Required plugins for this example: MBS Win Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/HTMLViewer Image

This example is the version from Sun, 16th Jan 2021.

Project "HTMLViewer Image.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() End EventHandler
End Class
Class MainWindow Inherits Window
Control Image1Button Inherits PushButton
ControlInstance Image1Button Inherits PushButton
EventHandler Sub Action() // resize web viewer to show full website without scrolling Dim doc As IEDocumentMBS = web.IEDocumentMBS If doc <> Nil Then Dim w As Integer = web.Width Dim h As Integer = web.Height web.Width = doc.ScrollWidth + 24 web.Height = doc.ScrollHeight + 24 // now get picture pic = doc.Image // restore size web.Width = w web.Height = h out.Invalidate Else MsgBox "No website loaded?" End If End EventHandler
End Control
Control web Inherits HTMLViewer
ControlInstance web Inherits HTMLViewer
End Control
Control out Inherits Canvas
ControlInstance out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) #Pragma unused areas If pic <> Nil Then Dim faktor As Double = Min( g.Height / Pic.Height, g.Width / Pic.Width) // Calculate new size Dim w As Integer = Pic.Width * faktor Dim h As Integer = Pic.Height * faktor // draw picture in the new size g.DrawPicture Pic, 0, 0, w, h, 0, 0, Pic.Width, Pic.Height End If End EventHandler
End Control
Control SaveButton Inherits PushButton
ControlInstance SaveButton Inherits PushButton
EventHandler Sub Action() If out.Backdrop = Nil Then Beep Else Call ExportPicture(out.Backdrop) End If End EventHandler
End Control
Control PrintButton Inherits PushButton
ControlInstance PrintButton Inherits PushButton
EventHandler Sub Action() // show print dialog Dim win As IEWindowMBS = web.IEWindowMBS if win <> nil then Call win.Print Else MsgBox "No website loaded?" End If End EventHandler
End Control
Control Image2Button Inherits PushButton
ControlInstance Image2Button Inherits PushButton
EventHandler Sub Action() // get picture as shown Dim doc As IEDocumentMBS = web.IEDocumentMBS If doc <> Nil Then pic = doc.Image out.Invalidate Else MsgBox "No website loaded?" End If End EventHandler
End Control
EventHandler Sub Open() web.LoadURL "http://www.monkeybreadsoftware.de" End EventHandler
Property Protected pic As Picture
End Class
MenuBar MenuBar1
MenuItem FileMenu = "File"
MenuItem FileQuit = "Exit"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...