Beispiel #1
0
		public Matrix GetMatrix(Window window)
		{
			Rectangle rectangle = window.Rectangle;
			Point rotationCenter;
			if (window.hasMenu)
				rotationCenter = new Point((rectangle.Width - SystemInformation.FrameBorderSize.Width) / 2.0, (rectangle.Height - SystemInformation.CaptionHeight - SystemInformation.MenuHeight - SystemInformation.FrameBorderSize.Height) / 2.0);
			else
				rotationCenter = new Point((rectangle.Width - SystemInformation.FrameBorderSize.Width) / 2.0, (rectangle.Height - SystemInformation.CaptionHeight - SystemInformation.FrameBorderSize.Height) / 2.0);

			Matrix result = new Matrix();
			result.Translate(-rotationCenter.X, -rotationCenter.Y);
			result.Rotate(Angle);
			result.Translate(rotationCenter.X, rotationCenter.Y);
			result.Translate(-ScaleCenter.X, -ScaleCenter.Y);
			result.Scale(Scale, Scale);
			result.Translate(ScaleCenter.X, ScaleCenter.Y);
			return result;
		}
Beispiel #2
0
		public bool EnumWindowsCallback(IntPtr hWnd, IntPtr lParam)
		{
			// Check if the window has any Owner, we do not need 
			// multiple Windows of an Application.
			IntPtr RetValue = NativeMethods.GetWindow(hWnd, NativeMethods.GetWindowCmd.GW_OWNER);
			int RetValueWL = NativeMethods.GetWindowLong(hWnd, NativeMethods.GetWindowLongIndex.GWL_STYLE);

			// If the handle belongs to our application lets not display it
			//If hWnd = fInstance.Handle.ToInt32 Then RetValue = -1

			if (NativeMethods.IsWindowVisible(hWnd))
			{
				if (RetValue == IntPtr.Zero && (RetValueWL & NativeMethods.WS_SYSMENU) != 0)
				{
					// Initialize a new Window Object
					Window window = new Window(hWnd);

					// Add the Window Item to the collection
					windows.Add(window.HWnd, window);
				}
			}

			// Return 1, so that the loop continues until the last window
			return true;
		}
Beispiel #3
0
		internal void FireEvent(NativeMethods.ShellEvents nEvent, IntPtr lExtraInfo)
		{
			if (MonitorWindowEvents)
			{
				//int pId;
				//int tId;
				switch (nEvent)
				{
					case NativeMethods.ShellEvents.HSHELL_WINDOWCREATED:
						if (!windows.ContainsKey(lExtraInfo))
						{
							Window window = new Window(lExtraInfo);
							windows.Add(window.HWnd, window);
							if (WindowCreated != null)
								WindowCreated(window);
						}

						break;
					case NativeMethods.ShellEvents.HSHELL_WINDOWDESTROYED:
						if (windows.ContainsKey(lExtraInfo))
						{
							if (WindowDestroyed != null)
								WindowDestroyed(windows[lExtraInfo]);
							windows.Remove(lExtraInfo);
						}

						break;
					case NativeMethods.ShellEvents.HSHELL_ACTIVATESHELLWINDOW:
						if (ShellWindowActivated != null)
							ShellWindowActivated();

						break;
					case NativeMethods.ShellEvents.HSHELL_WINDOWACTIVATED:
						if (!shellHandles.Contains("," + lExtraInfo + ","))
						{
							ActiveWindowHandle = lExtraInfo;
							if (WindowActivated != null)
								WindowActivated(windows[lExtraInfo]);
						}

						break;
					case NativeMethods.ShellEvents.HSHELL_TASKMAN:
						if (TaskManActivated != null)
							TaskManActivated(lExtraInfo);

						break;
					default:
						break;
				}
			}
		}