473,396 Members | 1,968 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,396 software developers and data experts.

Need some help with my insane window docking method...

Hello,
I've spent the better part of the day going over code and thinking and
have come up with the following docking method that works perfectly.
At this point, my brain is about to explode and I was wondering if
someone can help me figure out the calculations for right and bottom
docking:
note: lRelOffsetLeft and lRelOffsetTop are calculated on mousedown
(location of mouse in relation to top and left of picturebox)
_______________
Private Sub PictureMove_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles PictureMove.MouseMove
PixelsToDock = 10

If e.Button = Windows.Forms.MouseButtons.Left Then
'Top dock
'-2 to compensate for apparently incorrect
Screen.PrimaryScreen.Bounds.Top (window border?)
If Me.Top >= Screen.PrimaryScreen.Bounds.Top - 2 Then '
free floating out of docking area, and docking
newTop = (e.Y + Me.Top + PictureMove.Top) -
lRelOffsetTop
If newTop < 0 Then newTop = -2 'e.Y may make the
previously calculated newtop < -2
Me.Top = newTop
ElseIf (e.Y + Me.Top + PictureMove.Top) - lRelOffsetTop >=
PixelsToDock Then ' undock
'If newTop < 0 Then newTop = 0
newTop = (e.Y + Me.Top + PictureMove.Top) -
lRelOffsetTop
Me.Top = newTop
End If

'Left dock
If Me.Left >= Screen.PrimaryScreen.Bounds.Left Then ' free
floating out of docking area, and docking
newLeft = (e.X + Me.Left + PictureMove.Left) -
lRelOffsetLeft
If newLeft < 0 Then newLeft = 0 'e.X may make the
previously calculated newtop
Me.Left = newLeft
ElseIf (e.X + Me.Left + PictureMove.Left) - lRelOffsetLeft
>= PixelsToDock Then ' undock
newLeft = (e.X + Me.Left + PictureMove.Left) -
lRelOffsetLeft
Me.Left = newLeft
End If
End If

End Sub
__________________
The usual method of adjusting the location properties of a form causes
the form to "shake."
This does not do that. So if someone can help me figure out the
bottom and right calculations, we may have gold here.
Thanks!

Matt

Feb 4 '07 #1
2 2610
"Matt Brown - identify" <Ma**********@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
Hello,
I've spent the better part of the day going over code and thinking and
have come up with the following docking method that works perfectly.
At this point, my brain is about to explode and I was wondering if
someone can help me figure out the calculations for right and bottom
docking:
note: lRelOffsetLeft and lRelOffsetTop are calculated on mousedown
(location of mouse in relation to top and left of picturebox)
This sounds too much like you're wanting someone to do the work for you. I
can wade through the page and a bit of code you posted if you like but
you'll need to be paying me :-)
Feb 5 '07 #2
op... that was wrong.

Feb 5 '07 #3

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

Similar topics

3
by: Peter | last post by:
For some unknown reason my Form Layout Window has stopped showing a form on it. I can open & close the window, set docking on/off but no form. The right click start-up options are also greyed out....
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: Axial | last post by:
Can anybody tell me how the windows in Xselerator can be moved in order to switch docking to either vertical or horizontal? Inadvertent mouse clicks undock, but I can't figure out how to re-dock...
6
by: Lecture Snoddddgrass | last post by:
Greetings, Can anyone recommend a good 3rd party docking windows component for WinForms? I'm looking for something that allows windows to not only be docked but to "popout", much like the...
0
by: Steve McLellan | last post by:
Hi all, I've noticed that setting a Form's isMdiContainer to True results in the parent form allowing child windows to be moved out of its client area, and it adds scrollbars automatically to...
1
by: JDeats | last post by:
I have a WinForm that is set as an MDIContainer, I have an Panel on this form that has it's docking property set to "Top". When a spawn an MDI childform inside my parent all is well untill I...
2
by: Steve Teeples | last post by:
I want to create some tool windows like you see in the VS IDE. I created a form and set the FormBorderStyle to "SizableToolWindow". However, after several vain attempts I don't know how to...
0
by: alarock | last post by:
how can i do floating and docking a Form(window) in mdiparent+c#.. thanks advance,,, Regards, ALGATES.
2
by: Dean Slindee | last post by:
I am not looking for a "hybrid" WPF/WinForm or WinForm/WPF solution, but rather a pure WPF/WPFsolution. I want to host a WPF window inside another WPF window. I want to host a WPF window as a...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.