473,756 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Mou seMove(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles PictureMove.Mou seMove
PixelsToDock = 10

If e.Button = Windows.Forms.M ouseButtons.Lef t Then
'Top dock
'-2 to compensate for apparently incorrect
Screen.PrimaryS creen.Bounds.To p (window border?)
If Me.Top >= Screen.PrimaryS creen.Bounds.To p - 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.PrimaryS creen.Bounds.Le ft Then ' free
floating out of docking area, and docking
newLeft = (e.X + Me.Left + PictureMove.Lef t) -
lRelOffsetLeft
If newLeft < 0 Then newLeft = 0 'e.X may make the
previously calculated newtop
Me.Left = newLeft
ElseIf (e.X + Me.Left + PictureMove.Lef t) - lRelOffsetLeft
>= PixelsToDock Then ' undock
newLeft = (e.X + Me.Left + PictureMove.Lef t) -
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 2633
"Matt Brown - identify" <Ma**********@g mail.comwrote in message
news:11******** **************@ h3g2000cwc.goog legroups.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
13500
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. Any idea how I can fix this? Thanks --
0
9873
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 ********************************** package Celcom.Client;
0
1159
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 vertically. Thx in advance, Sheila
6
2965
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 Solution Explorer or Toolbox in Visual Studio.NET. For my last project, I used the SyncFusion component for docking windows, but my experience is that SyncFusion is buggy. I'd prefer to use a different vendor for this project. Any advice? Thanks,
0
1298
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 accomodate this. Is there any easy way of disabling this, and further is there any way of limiting the area to which client windows are allowed in? For example, to reserve part of the parent window for other stuff. Docking another control to an edge...
1
4003
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 maximize the MDI child window, when I do this the title bar (with max, min buttons, etc..) for the child appears above my docked Panel. The desired effect is for the MDI child window to maximize with its title bar under the the docked panel on the...
2
2203
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 proceed correctly from there. I'd like this form to dock within another form just as it does in the IDE. Does someone know how this is done? -- Steve
0
909
by: alarock | last post by:
how can i do floating and docking a Form(window) in mdiparent+c#.. thanks advance,,, Regards, ALGATES.
2
8923
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 "control" inside another WPF window, much like a button is hosted inside a WPF window. This may not be possible today in WPF, but that is what I am trying to determine. Since WPF is a 1.0 product, perhaps the answer is: wait for a more complete...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.