选择用户控件 [英] select User control

查看:45
本文介绍了选择用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在面板上动态创建了许多用户控件.现在我要选择用户控件并实现剪切,复制,粘贴功能..
所以我的问题是如何在垂直区域中选择一组用户控件.

I many usercontrol created dynamically on a panel. Now I want to select usercontrol and implement cut, copy, paste feature..
so my problem is how to select a group of usercontrol In a perticular region.

推荐答案

在您发表评论后:

抱歉,我记错了.我应该说Intersect.

您已经绘制了一个矩形.您可以依次获取控件的Bounds属性(搜索"c#迭代控件")以了解如何进行操作,这是一个矩形.然后为每个控件使用:

After your comment:

Sorry, I misremembered. I should have said Intersect.

You have a rectangle that you have drawn. You can get the Bounds property of the controls in turn (search for ''c# iterate controls'') to find out how, which is a rectangle. Then for each control use:

if (Rectangle.Intersect(myDrawnRectangle, controlBoundsRectangle) != Rectangle.Empty)
{
   // part of the control is in your rectangle
   // do what you want with it.
}



祝你好运! :)



Good luck! :)


如果您使用的是Windows窗体,请 ^ ]可能会给您一些想法.
If you are using Windows Forms, this[^] might give you a few ideas.


这篇关于选择用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆