CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Mar 2007
    Posts
    274

    [RESOLVED] Detect vertical scroll in picturebox?

    Do I have to pinvoke to do this?

    I tried

    Code:
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                myPictureBox x = new myPictureBox();
                x.Dock = DockStyle.Fill;
                this.Controls.Add(x);
            }
        }
    
        public class myPictureBox : PictureBox
        {
            protected override void WndProc(ref Message m)
            {
                base.WndProc(ref m);
    
                if (m.Msg == 0x115)
                {
                    if (m.WParam.ToInt32() < 0)
                    {
                    }
    
                    else
                    {
                    }
                }
            }
        }
    But I think thats only for controls with a vertical scroll bar. Picturebox does not seem to fire the OnMouseWheel event....... Any ideas on how to do this in managed code?
    Last edited by Traps; February 10th, 2009 at 10:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured