Jump to content

Embedded IE control


Polyphem
 Share

Recommended Posts

HiHo,

is it possible to set the behavior of an embedded IE control to auto-downsize a displayed picture to the dimensions of the control (zoom)? E.g. if you open a picture file manually with IE and resize the browser to a smaller dimension than the original picture, IE will auto-downsize the picture too...

#include <GUIConstantsEx.au3>
#include<IE.au3>

GUICreate("My GUI")

$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 100, 100)
_IENavigate($oIE, "about:blank")
_IEPropertySet ($oIE,"height",100)
_IEPropertySet ($oIE,"width",100)
$oIE.document.body.background.resize
_IEDocWriteHTML ($oIE, '<body style="margin:0px;padding:0px;"><img style="margin:0px;padding:0px;" src="' & @ScriptDir & "\test.jpg" & '"></body>')
$oIE.document.body.scroll = "no"
$oIE.document.body.style.border = "0px"
_IEPropertySet($oIE,"contenteditable",false)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

Regards

Poly

This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Hi Polyphem,

Try the following way:

CODE

#include <GUIConstantsEx.au3>

#include <IE.au3>

GUICreate("My GUI")

$width = 100

$height = 100

$oIE = _IECreateEmbedded()

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 300, 300)

_IENavigate($oIE, "about:blank")

_IEPropertySet ($oIE,"height", $height)

_IEPropertySet ($oIE,"width", $width)

$oIE.document.body.background.resize

_IEDocWriteHTML ($oIE, '<body style="margin:0px;padding:0px;"><img style="margin:0px;padding:0px; width="' & $width & '" height="' & $height & '" src="' & @ScriptDir & "\test.jpg" & '"></body>')

$oIE.document.body.scroll = "no"

$oIE.document.body.style.border = "0px"

_IEPropertySet($oIE,"contenteditable",false)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

GUIDelete()

It was working for me..

I hope it will help you.

Edited by dworld

dworldI'm new in autoit, but I like it. My mind is open to the new things.

Link to comment
Share on other sites

It was working for me..

I hope it will help you.

Perfect :P, thanks a lot for your help :P. Tweaked it slightly, so that scrollbars are hidden and the control itself is disabled... want to use it as a pure pictureviewer...

#include <GUIConstantsEx.au3>
#include <IE.au3>

GUICreate("My GUI")

Local $width = 150
Local $height = 150

$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 300, 300)
GUICtrlSetState(-1,$GUI_DISABLE)
_IENavigate($oIE, "about:blank")
_IEPropertySet ($oIE,"height", $height)
_IEPropertySet ($oIE,"width", $width)
$oIE.document.body.background.resize
_IEDocWriteHTML($oIE, '<body style="margin:0px;padding:0px;"><img style="margin:0px;padding:0px; width="' & $width & '" height="' & $height & '" src="' & @ScriptDir & "\test.jpg" & '"></body>')
$oIE.document.body.scroll = "no"
$oIE.document.body.style.border = "0px"



$oIE2 = _IECreateEmbedded()
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 10, 210, 300, 300)
GUICtrlSetState(-1,$GUI_DISABLE)
_IENavigate($oIE2, "about:blank")
_IEPropertySet ($oIE2,"height", $height)
_IEPropertySet ($oIE2,"width", $width)
$oIE2.document.body.background.resize
_IEDocWriteHTML($oIE2, '<body style="margin:0px;padding:0px;"><img style="margin:0px;padding:0px; width="' & $width & '" height="' & $height & '" src="' & @ScriptDir & "\test.jpg" & '"></body>')
$oIE2.document.body.scroll = "no"
$oIE2.document.body.style.border = "0px"

GUISetState()

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

Thanks a lot and have a nice day :o

Edited by Polyphem
This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...