c# - 位置限制与表格的大小
问题描述
您好我一直想知道如何使用表单的大小设置位置限制。
private Point MouseDownLocation;
private void labelControl1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
MouseDownLocation = e.Location;
}
}
private void labelControl1_MouseMove(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
labelControl1.Left = e.X + labelControl1.Left - MouseDownLocation.X;
labelControl1.Top = e.Y + labelControl1.Top - MouseDownLocation.Y;
}
}
这是我一直在使用的代码。有人可以帮忙吗。任何代码都是有用的,我只想要一些如何做的例子。
解决方案
推荐阅读
- reactjs - 使用 React Storybook 的 Knob 插件避免重复道具名称的可重用功能?
- javascript - jest.mock 模块工厂函数调用
- java - 将某个 json 值传递给另一个活动
- javascript - Angular Focusout 事件无法与表一起正常工作
- java - 如何创建一个识别 AbsoluteLayout 而不抛出 NoClassDefFoundError 的 jar?
- linux - 分叉子进程中外壳中的箭头键和颜色输出
- angular - 使用 NgbModal.open() 方法打开新的模态窗口时如何添加多个选项?
- ios - 无法在 IOS 模拟器上运行 ReactNative 应用程序
- go - Cloud-Run 进程失败并出现 500 状态代码和一个 membarrier gvisor 错误
- excel - 用特定单词+文本拆分文本到新行