public static void Send(CaptionButtonType dock) { ushort keyCode = dock == CaptionButtonType.DockLeft ? (ushort)0x25 : (ushort)0x27; // left: right var inputs = new[] { new INPUT { Type = 1, Data = new MOUSEKEYBDHARDWAREINPUT { Keyboard = new KEYBDINPUT { Vk = (ushort)0x5b, //LWIN Flags = 0 } } }, new INPUT { Type = 1, Data = new MOUSEKEYBDHARDWAREINPUT { Keyboard = new KEYBDINPUT { Vk = keyCode, Flags = 1 } } }, new INPUT { Type = 1, Data = new MOUSEKEYBDHARDWAREINPUT { Keyboard = new KEYBDINPUT { Vk = keyCode, Flags = 3 } } }, new INPUT { Type = 1, Data = new MOUSEKEYBDHARDWAREINPUT { Keyboard = new KEYBDINPUT { Vk = (ushort)0x5b,//LWIN Flags = 2 } } }, }; var res = SendInput((uint)inputs.Length, inputs, Marshal.SizeOf(typeof(INPUT))); }
private CaptionButtonViewModel CreateButton(CaptionButtonType type, PackIconKind icon, string name, Action action, CaptionButtonViewModel[] subItems = null) { return(new CaptionButtonViewModel { Type = type, Icon = icon, Name = name, SubItems = subItems, Action = action }); }
public CaptionButton(string id, Vector2 position, ColorArray colorArray, CaptionButtonType type) : base(id, position, new Size(DefaultCaptionButtonWidth, DefaultCaptionButtonHeight), Shape.Custom, BorderStyle.Raised, Shapes.ShadeTopToBottom, colorArray) { shapeDescriptors = new ShapeDescriptor[2]; isFocusable = false; crossTopLeftPosition = new Vector2(DefaultCaptionButtonWidth / 2 - DefaultCrossWidth / 2, DefaultCrossPaddingY); buttonType = type; }
private CaptionButtonViewModel Create(CaptionButtonType type) { switch (type) { case CaptionButtonType.Close: return(CreateButton(type, PackIconKind.Close, "Close", () => SystemCommands.CloseWindow(_window))); case CaptionButtonType.Maximize: return(CreateButton(type, PackIconKind.WindowMaximize, "Maximize", () => SystemCommands.MaximizeWindow(_window))); case CaptionButtonType.Minimize: return(CreateButton(type, PackIconKind.WindowMinimize, "Minimize", () => SystemCommands.MinimizeWindow(_window))); case CaptionButtonType.Restore: return(CreateButton(type, PackIconKind.WindowRestore, "Restore", () => SystemCommands.RestoreWindow(_window))); case CaptionButtonType.EnterFullScreen: return(CreateButton(type, PackIconKind.Fullscreen, "Fullscreen", () => GoToState(AppWindowState.FullScreen))); case CaptionButtonType.ExitFullScreen: return(CreateButton(type, PackIconKind.FullscreenExit, "Exit fullscreen", () => GoToState(_stateBeforeFullscreen))); case CaptionButtonType.DockLeft: return(CreateButton(type, PackIconKind.ArrowCollapseLeft, "Dock left", () => DockLeft())); case CaptionButtonType.DockRight: return(CreateButton(type, PackIconKind.ArrowCollapseRight, "Dock right", () => DockRight())); case CaptionButtonType.CompactView: return(CreateButton(type, PackIconKind.Crop, "Compact View", () => GoToState(AppWindowState.Compact))); case CaptionButtonType.NormalView: return(CreateButton(type, PackIconKind.FilePresentationBox, "Normal View", () => GoToState(AppWindowState.Normal))); default: throw new Exception(); } }
public ToolWindowCaptionButton(ToolWindowOld parent, CaptionButtonType buttonType) { Parent = parent; ButtonType = buttonType; _bounds = Rectangle.Empty; }