Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 482847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:08:14+00:00 2026-05-13T01:08:14+00:00

How can I handle tilt left or tilt right mouse event in WPF? alt

  • 0

How can I handle tilt left or tilt right mouse event in WPF?
alt text http://s3images.coroflot.com/user_files/individual_files/featured/featured_1266_st_dVYgtBSHIQRPzXvrG4WnUW.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:08:15+00:00Added an answer on May 13, 2026 at 1:08 am

    I figured out how to implement WndProc in WPF UserControl. UserControl must obtain a window pointer like by AppendWindow method in my example:

    private static MyUserControl instanceWithFocus;
    
    public void AppendWindow(Window window) {
        HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(window).Handle);
        source.AddHook(new HwndSourceHook(WndProc));
    }
    
    private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
        switch (msg) {
            case Win32Messages.WM_MOUSEHWHEEL:
                MouseWheelTilt(wParam, lParam);
                handled = true;
                break;
            default:
                break;
        }
        return IntPtr.Zero;
    }
    
    private static void MouseWheelTilt(IntPtr wParam, IntPtr lParam) {
        Int32 tilt = (Int16)Utils.HIWORD(wParam);
        Int32 keys = Utils.LOWORD(wParam);
        Int32 x = Utils.LOWORD(lParam);
        Int32 y = Utils.HIWORD(lParam);
    
        // call an event on active instance of this object
        if (instanceWithFocus != null) {
            instanceWithFocus.MouseWheelTilt(tilt, keys, x, y);
        }
    }
    
    private void MouseWheelTilt(Int32 tilt, Int32 keys, Int32 x, Int32 y) {
        scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + tilt);
    }
    
    private void UserControl_MouseEnter(object sender, MouseEventArgs e) {
        instanceWithFocus = this;
    }
    
    private void UserControl_MouseLeave(object sender, MouseEventArgs e) {
        instanceWithFocus = null;
    }
    
    abstract class Win32Messages {
        public const int WM_MOUSEHWHEEL = 0x020E;
    }
    
    abstract class Utils {
    
        internal static Int32 HIWORD(IntPtr ptr) {
            Int32 val32 = ptr.ToInt32();
            return ((val32 >> 16) & 0xFFFF);
        }
    
        internal static Int32 LOWORD(IntPtr ptr) {
            Int32 val32 = ptr.ToInt32();
            return (val32 & 0xFFFF);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How I can handle map move event by user? (Down left mouse button and
I'm wondering if Fuel ORM can handle the design described here: http://www.codeproject.com/KB/aspnet/LocalizedSamplePart2/normalizedSchema.gif The following
Can anyone suggest a plugin which can handle text selections in text areas (cross
I am wondering if I can handle a session timeout event. I need to
I have multiple superposed controls which can handle a mouse click under certain conditions.
How many http request does a browser can handle in a single html page.
in asp.net we can handle the RowDataBound event of the GridView control. this event
How can I handle all states of orientation event occurs? Something like: before starting
Suppose I am designing a class that can handle any database technology to create
I need a c# number something that can handle very large numbers but also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.