From: Armin Zingler on
Am 26.04.2010 14:38, schrieb zzz:
>> Am 26.04.2010 11:20, schrieb zzz:
>>> Hi to all,
>>> inside a subroutine i have this code:
>>>
>>> Me.PictureBox1.Size = New Size(Me.dimensioni.Width * Me.zoom_factor,
>>> Me.dimensioni.Height * Me.zoom_factor)
>>
>> Which event handler calles this sub routine?
>>
>> What does
>>
>> debug.print(Me.PictureBox1.Size.tostring)
>>
>> output directly after the assignment?
>
> My code is inside
> ..MouseWheel event( is about zooming an image displayed in a form).


> Private Sub pict_MouseMove(ByVal sender As System.Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel
>
> try
>
> If e.Delta < 0 Then
>
> Me.zoom_factor *= 2
>
> Else
>
> Me.zoom_factor /= 2
>
> End If
>
> Me.PictureBox1.Size = New Size(Me.dimensioni.Width * Me.zoom_factor,
> Me.dimensioni.Height * Me.zoom_factor)
>
> Debug.Print(Me.zoom_factor.ToString)
>
> Catch ex As Exception
>
> MsgBox(ex.Message)
>
> End Try


Switch Option Strict On.


> when zoom_factor reaches a 2048 value, I get the error, but the exception is
> not raised.....so I really don't known where the dll exception is raised.

It's shown in the call stack you've posted before. The error occurs as soon
as the picturebox is to be repainted.


> Maybe too large dimension of image makes it up....

Unanswered:

debug.print(Me.PictureBox1.Size.tostring)

Anyway, it's too large. What are you trying? I guess you have a picturebox
inside another control with Autscroll=true, right? If that large zoom factors
are expected, you must do the painting on your own by painting only the section
that shall be visible at the current scroll position.


--
Armin
From: zzz on

"Armin Zingler" <az.nospam(a)freenet.de> ha scritto nel messaggio
news:ePHBSaU5KHA.620(a)TK2MSFTNGP02.phx.gbl...
> Am 26.04.2010 14:38, schrieb zzz:
CUT
> Unanswered:
>
> debug.print(Me.PictureBox1.Size.tostring)
>
> Anyway, it's too large. What are you trying? I guess you have a picturebox
> inside another control with Autscroll=true, right? If that large zoom
> factors
> are expected, you must do the painting on your own by painting only the
> section
> that shall be visible at the current scroll position.
>

Ok, I have turned Option Strict ON.
debug.print(Me.PictureBox1.Size.tostring):

{Width=16384, Height=16384}

I have a picturebox filling a form...so how can I scroll the image when it
is larger than teh form?

How can I paint only the visibile section of the form?

Thanks

:)




From: Armin Zingler on
Am 26.04.2010 16:00, schrieb zzz:
> Ok, I have turned Option Strict ON.

Hard to believe. :-) Because:
zoom_factor must be of type Single or Double, otherwise this does not compile:
> Me.zoom_factor /= 2


And if zoom_factor is Single/Double, the following line does not work because
the Size constructor doesn't accept floating point values:

> Me.PictureBox1.Size = New Size(Me.dimensioni.Width * Me.zoom_factor,
> Me.dimensioni.Height * Me.zoom_factor)


> debug.print(Me.PictureBox1.Size.tostring):
>
> {Width=16384, Height=16384}

Thx.

> I have a picturebox filling a form...so how can I scroll the image when it
> is larger than teh form?

Put scrollbars on the Form.

> How can I paint only the visibile section of the form?

By passing the appropriate values as the srcWidth/srcHeight parameters
to the graphics.drawimage method called in the Form's paint event.
The srcX/srcY argument values depend on the current scroll position.


--
Armin
From: zzz on

"Armin Zingler" <az.nospam(a)freenet.de> ha scritto nel messaggio
news:uiOVm3U5KHA.6052(a)TK2MSFTNGP02.phx.gbl...
> Am 26.04.2010 16:00, schrieb zzz:
>> Ok, I have turned Option Strict ON.
>
> Hard to believe. :-) Because:

I mean: now I have turned on Option Strict :D

> By passing the appropriate values as the srcWidth/srcHeight parameters
> to the graphics.drawimage method called in the Form's paint event.
> The srcX/srcY argument values depend on the current scroll position.

Can I ask you 3 code rows? ;)


From: Armin Zingler on
Am 26.04.2010 16:54, schrieb zzz:
> Can I ask you 3 code rows? ;)

Yep, go on asking. :)


--
Armin
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: form inheritence
Next: Sync Framework with multiple branch