i have a form and i need to use mouse scroll for moving my panel.
so i need to create event ( :) ok ok im not sure ) and No matter where the selected i need to use this event when i use mousescroll :) I hope i was explain.
is there any way to do it?
I think u r looking for intelli-zoom procedure as like AUTOCAD...
U have to keep the Mainpic(ie., ur panel) always focused using
Mainpic.Focus in key events..
'--Note: Mainpic is a panel
Private Sub mainpic_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mainpic.MouseWheel
Dim xw, yw As Single
xw = e.X / zm
yw = e.Y / zm
'If scrolll = True Then
If e.Delta > 0 Then
If zm < 20 Then
zm = zm + 0.25
If zm > 1 Then
zm = zm - 0.25
If e.X <> xw * zm Then
mainpic.Width = 1600 * zm
mainpic.Height = 1600 * zm
HScrollBar1.Maximum = (1600 * zm) - coverpic.Width
VScrollBar1.Maximum = (1600 * zm) - coverpic.Height
xw = -(mainpic.Left - ((xw * zm) - e.X))
yw = -(mainpic.Top - ((yw * zm) - e.Y))
If xw <= HScrollBar1.Minimum Then
mainpic.Left = -1
HScrollBar1.Value = 0
ElseIf xw >= HScrollBar1.Maximum Then
mainpic.Left = -HScrollBar1.Maximum
HScrollBar1.Value = HScrollBar1.Maximum
mainpic.Left = -xw
HScrollBar1.Value = xw
If yw <= VScrollBar1.Minimum Then
mainpic.Top = -1
VScrollBar1.Value = 0
ElseIf yw >= VScrollBar1.Maximum Then
mainpic.Top = -VScrollBar1.Maximum
VScrollBar1.Value = VScrollBar1.Maximum
mainpic.Top = -yw
VScrollBar1.Value = yw
MDIMain.ToolStripzoom.Text = zm * 100
'----ZM is the transformation value used for graphics.scaletransformation
umm first of all thx for this example :) but i have a program and my my form have 1024x768 pxl so when i instal this program on my notebook and my notebooks resolution is 1024x600 and i need to see between 600 - 768 pixels. then i create a scroll for this so this scroll automatically adjusts itself in accordance with a resolution of the form is loaded. and i need to control this scroll with my mousescroll . i know mousewhell event but i cant use this couse when i using textbox i cant control my scroll.
so i want to use my vbscroll everytime (when i scroll my whell i wanna use vbscroll)
sorry my english isnt enough :) i hope u understanded me