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

  • SEARCH
  • Home
  • 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 547473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:58:37+00:00 2026-05-13T10:58:37+00:00

Well im trying to make my own basic Slider control just so i can

  • 0

Well im trying to make my own basic Slider control just so i can learn abit how to interact with the mouse…

so far i have this:

vb.net:

Private Sub Rectangle_MouseMove(ByVal sender as Object, ByVal e as System.Windows.Input.MouseEventArgs)

If (e.LeftButton = MouseButtonState.Pressed) Then
    Dim p As Point = Mouse.GetPosition(Me)
    Rectangle.SetValue(FrameworkElement.MarginProperty, New Thickness(p.X - Rectangle.Width / 2, 0, 0, 0))
End If
End Sub

Private Sub Rectangle_MouseDown(ByVal sender as Object, ByVal e as System.Windows.Input.MouseButtonEventArgs)

End Sub

Private Sub Rectangle_MouseUp(ByVal sender as Object, ByVal e as System.Windows.Input.MouseButtonEventArgs)

End Sub

xaml:

<Rectangle x:Name="Rectangle" Fill="White" Stroke="Black" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="100" Height="75" MouseMove="Rectangle_MouseMove" MouseDown="Rectangle_MouseDown" MouseUp="Rectangle_MouseUp"/>

so this works while the mouse is on the rectangle.. but if we look how the slider behaves its not the same you click and hold the mouse down and can drag it any where even outside of the window and it still updates its position..

So how is this done? my guess is its the Mouse Class but i don’t understand how to use it.

  • 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-13T10:58:37+00:00Added an answer on May 13, 2026 at 10:58 am

    Try using the Mouse.Capture method.

    You pass it a reference to your control and:

    When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders.

    If a CaptureMode is not specified, the default CaptureMode is Element.

    Take note of the CaptureMode overload. This enumeration can help if your capturing with sub elements, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.