VBExpress
پنج شنبه 08 فروردین 1387, 21:16 عصر
سلام
وقتی عکس رو زوم میکنم از قسمت بالا-چپ بزرگ میشه ... در صورتی که من می خوام مثل برنامه ACD see عکس دقیقا از قسمتی که کاربر اون رو مشاهده میکنه بزرگ بشه
Imports System.drawing
Imports System.drawing.drawing2D
Imports System.windows.forms
PublicClass Class1
Inherits ScrollableControl
Private _zoom AsDouble = 1
Property zoom() AsDouble
Get
Return _zoom
EndGet
Set(ByVal value AsDouble)
_zoom = value
Scrollbars()
Invalidate()
EndSet
EndProperty
PublicSubNew()
Me.SetStyle(ControlStyles.UserPaint Or _
ControlStyles.AllPaintingInWmPaint Or _
ControlStyles.ResizeRedraw Or _
ControlStyles.OptimizedDoubleBuffer, True)
Scrollbars()
Invalidate()
EndSub
PrivateSub Scrollbars()
Me.AutoScrollMinSize = New Size _
(CInt(Me._image.Width * _zoom + 0.5), CInt(Me._image.Height * _zoom + 0.5))
EndSub
Private _image As Image = Image.FromFile("C:\VBExpress.bmp")
ProtectedOverridesSub OnPaint(ByVal e As PaintEventArgs)
Dim Mx AsNew Matrix(_zoom, 0, 0, _zoom, 0, 0)
Dim g As Graphics = e.Graphics
Dim Rec AsNew Rectangle(0, 0, _image.Width, _image.Height)
Mx.Translate(Me.AutoScrollPosition.X / _zoom, _
Me.AutoScrollPosition.Y / _zoom)
g.Transform = Mx
g.DrawImage(_image, Rec, Rec, GraphicsUnit.Pixel)
MyBase.OnPaint(e)
EndSub
EndClass
لطفا کمک کنید
وقتی عکس رو زوم میکنم از قسمت بالا-چپ بزرگ میشه ... در صورتی که من می خوام مثل برنامه ACD see عکس دقیقا از قسمتی که کاربر اون رو مشاهده میکنه بزرگ بشه
Imports System.drawing
Imports System.drawing.drawing2D
Imports System.windows.forms
PublicClass Class1
Inherits ScrollableControl
Private _zoom AsDouble = 1
Property zoom() AsDouble
Get
Return _zoom
EndGet
Set(ByVal value AsDouble)
_zoom = value
Scrollbars()
Invalidate()
EndSet
EndProperty
PublicSubNew()
Me.SetStyle(ControlStyles.UserPaint Or _
ControlStyles.AllPaintingInWmPaint Or _
ControlStyles.ResizeRedraw Or _
ControlStyles.OptimizedDoubleBuffer, True)
Scrollbars()
Invalidate()
EndSub
PrivateSub Scrollbars()
Me.AutoScrollMinSize = New Size _
(CInt(Me._image.Width * _zoom + 0.5), CInt(Me._image.Height * _zoom + 0.5))
EndSub
Private _image As Image = Image.FromFile("C:\VBExpress.bmp")
ProtectedOverridesSub OnPaint(ByVal e As PaintEventArgs)
Dim Mx AsNew Matrix(_zoom, 0, 0, _zoom, 0, 0)
Dim g As Graphics = e.Graphics
Dim Rec AsNew Rectangle(0, 0, _image.Width, _image.Height)
Mx.Translate(Me.AutoScrollPosition.X / _zoom, _
Me.AutoScrollPosition.Y / _zoom)
g.Transform = Mx
g.DrawImage(_image, Rec, Rec, GraphicsUnit.Pixel)
MyBase.OnPaint(e)
EndSub
EndClass
لطفا کمک کنید