473,378 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

What do you think of this "SnapToDefaultButton" code?



The code is to snap the mouse cursor to a given button but only if the user
allows it.

I've never read ControPanel values and wonder if there is a better way to
get the info.

The Cursor.Position code was copied from another post.

I sure like to hear if there is a better way but also I'd like confirmation
that this is OK if that is so.

Thanks

Public Shared Sub SnapToButton(ByVal this As Form, ByVal button As Button)

Dim lCurrentUserKey As RegistryKey =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("C ontrol Panel\Mouse")

If Not lCurrentUserKey Is Nothing Then

Dim GetValue As Integer =
lCurrentUserKey.GetValue("SnapToDefaultButton", -1)

If GetValue = 1 Then

button.NotifyDefault(True)

Dim p As New Point

p.X = button.Left + (button.Width \ 2)

p.Y = button.Top + (button.Height \ 2)

Cursor.Position = this.PointToScreen(p)

End If

End If

End Sub
Nov 21 '05 #1
0 948

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nige | last post by:
I've got a form which has the following code: <form action="/cgi-bin/FormMail.pl" method="POST" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1"> ...
18
by: Scott Brady Drummonds | last post by:
Hi, everyeone, I recently stumbled on some code that someone else wrote that I don't like. However, I'm having trouble articulating what the bad quality of the following code is. The...
28
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr();...
53
by: jaso | last post by:
Can you give any comments on this code? I used one goto, is it bad? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <assert.h> #define NOT_NULL 1
2
by: atlkhan | last post by:
Can someone please explain this php code. I would be grateful <?php // --------------- file tape2matlab2php.php // NOTE: if web-server and matlab server are NOT located on the same mashine...
1
by: Rocky86 | last post by:
Hi ppl anyone care to explain to me what is the following PHP code doing? $uname=$_GET; if($uname=="all") { $fetched=mysql_query("SELECT * FROM location"); while($row =...
33
by: Rocky86 | last post by:
Hello can somebody explain the code to me thx in advance!! <?php $temp=""; $sqlconnect=mysql_connect("localhost","hyperian_track","__munged__"); if(!$sqlconnect) die(mysql_error()); ...
8
by: Matt | last post by:
Hello. I'm struggling to work out what bit of matrix manipulation the following piece of code is doing to the 3x3 matrix given: #include <stdio.h> int main() { int check_mat = { { 1 , 2...
21
by: Spiros Bousbouras | last post by:
At http://www.lysator.liu.se/c/dmr-on-noalias.html Dennis Ritchie strongly denounces some noalias qualifier which was proposed for addition to the language at some point. Can someone give me some...
7
by: AAaron123 | last post by:
I read the help on which says: The ClientScriptManager class is used to manage client-side scripts and add them to Web applications... But could use a little help. Can someone tell me what...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.