Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- While Animating windows forms to slide in, Form Appearing at wrong location
- [DllImport("user32")]
- static extern bool AnimateWindow(IntPtr hwnd, int time, int flags);
- //Set the Location negative values are being returned when my dialog appears
- this.Location = new Point(LocationMainX + WidthOfMain, locationMainy + 10);
- //Animate form
- AnimateWindow(this.Handle, 750, AW_SLIDE | AW_HOR_POSITIVE);
- AddForm form = new AddForm (this.DesktopLocation)
- form.ShowDialog(); //I have also noticed doing form.Show(); messes with the position of dialog
- AddForm form = new AddForm (this.Parent.DesktopLocation)
- form.ShowDialog();
- using System.Runtime.InteropServices;
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);
- [StructLayout(LayoutKind.Sequential)]
- public struct RECT
- {
- public int Left;
- public int Top;
- public int Right;
- public int Bottom;
- }
- RECT fromRECT;
- GetWindowRect(new HandleRef(this, button1.Handle), out fromRECT);
- form.Location = new Point(fromRECT.Left + (fromRECT.Right - fromRECT.Left), fromRECT.Top);
- form.Show();
Add Comment
Please, Sign In to add comment