Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
1) Code:var tp = action.Window.Rectangle.Top;
var bt = action.Window.Rectangle.Bottom;
//You did not include gTopBottomMargin or gLeftRightMargin, so I declare them here, change as needed
var gTopBottomMargin = 50;
var gLeftRightMargin = 50;
//You did not include the definition for gShowScreenMessage, so I'm using the
//sp.DisplayText function, change as needed
var info = new DisplayTextInfo();
info.Duration = 1000;
info.Location = action.Start.X + ',' + action.Start.Y;
info.Padding = 15;
if(action.Start.Y < (tp + gTopBottomMargin)) {
// 在程序窗口顶栏进行操作,撤消
//gShowScreenMessage("撤消", 1, gsx, gsy)
info.Title = '';
info.Message = '撤消';
sp.DisplayText(info);
sp.SendKeys("^z")
} else if (action.End.Y > (bt - gTopBottomMargin)) {
// 在程序窗口底栏进行操作,取消单元格合并
//gShowScreenMessage("取消单元格合并", 1, gsx, gsy)
info.Title = '';
info.Message = '取消单元格合并';
sp.DisplayText(info);
sp.SendKeys("%")
sp.SendKeys("h")
sp.SendKeys("m")
sp.SendKeys("u")
} else if (action.End.X < gLeftRightMargin ) {
// 拖到屏幕的左栏,左对齐
sp.SendKeys("+{DELETE}")
} else {
// 退格
//gShowScreenMessage("退格", 2, gsx, gsy)
info.Title = '';
info.Message = '退格';
sp.DisplayText(info);
sp.SendKeys("{BACKSPACE}")
}
2) Code:var bt = Screen.FromPoint(new Point(action.Start.X, action.Start.Y)).WorkingArea.Bottom;
//You did not include gTopBottomMargin or gLeftRightMargin, so I declare them here, change as needed
var gTopBottomMargin = 50;
var gLeftRightMargin = 50;
//You did not include the definition for gShowScreenMessage, so I'm using the
//sp.DisplayText function, change as needed
var info = new DisplayTextInfo();
info.Duration = 1000;
info.Location = action.Start.X + ',' + action.Start.Y;
info.Padding = 15;
if (action.End.X < gLeftRightMargin || action.End.Y > (bt - gTopBottomMargin)) {
// 当鼠标拖到屏幕左、底栏时,显示桌面
//gShowScreenMessage("显示桌面", 2, gsx, gsy)
info.Title = '';
info.Message = '显示桌面';
sp.DisplayText(info);
sp.SendModifiedVKeys([vk.LWIN], [vk.VK_D]);
} else {
// 最小化
//gShowScreenMessage("最小化", 2, gsx, gsy)
info.Title = '';
info.Message = '最小化';
sp.DisplayText(info);
action.Window.Minimize();
}
|