タイトル | : Re^3: アニメgifの最大化 |
記事No | : 10995 |
投稿日 | : 2007/12/25(Tue) 10:46 |
投稿者 | : 魔界の仮面弁士 |
> Resizeイベントを用いて、WebBrowserのプロパティを変更するということでしょうか?
Option Explicit
Private img As Object Private imgStyle As Object Private baseWidth As Integer Private baseHeight As Integer
Private Sub Form_Load() ScaleMode = vbPixels WebBrowser1.Navigate "C:\sample.gif" WebBrowser1.RegisterAsDropTarget = False End Sub
Private Sub Resize() WebBrowser1.Move 0, 0, ScaleWidth, ScaleHeight If img Is Nothing Then Exit Sub End If Dim xZoom As Single, yZoom As Single On Error Resume Next xZoom = ScaleWidth / baseWidth yZoom = ScaleHeight / baseHeight If Err.Number <> 0 Then xZoom = 1! yZoom = 1! End If On Error GoTo 0 If xZoom <= 1! Or yZoom <= 1! Then imgStyle.zoom = "100%" Else imgStyle.zoom = Format(IIf(xZoom < yZoom, xZoom, yZoom), "0.000%") End If End Sub
Private Sub Form_Resize() Resize End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Dim doc As Object Set doc = pDisp.Document Dim body As Object Set body = doc.body With body.runtimeStyle .padding = "0" .margin = "0" .overflow = "hidden" .BorderStyle = "none" .backgroundColor = "ThreeDFace" End With Set img = doc.getElementsByTagName("IMG")(0) baseWidth = img.clientWidth baseHeight = img.clientHeight Set imgStyle = img.runtimeStyle imgStyle.margin = "0" Resize End Sub
|