调整圆形的大小 [英] Resizing a Round Form

查看:77
本文介绍了调整圆形的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



通过将以下代码添加到Piant事件中,创建了一个圆形的Windows窗体:

Hi There,

I created a round windows form by adding the following code into the Piant event:

System.Drawing.Drawing2D.GraphicsPath objGP = new System.Drawing.Drawing2D.GraphicsPath();
         objGP.AddEllipse(new Rectangle(0, 0, this.Width , this.Height));
         this.Region = new Region(objGP);
         this.FormBorderStyle = FormBorderStyle.None;



如何做才能像具有边框的普通Windows窗体一样调整此窗体的大小?

例如当鼠标位于表单的边缘/角落时,应该显示大小光标之一,并且我应该能够以这种方式调整表单的大小.

有什么建议吗?



How can I do to enable this form to be resized like like a normal windows form with borders?

e.g. When the mouse is on the edge/corner of the form one of the size cursors should display and i should be able to resize the form in that way.

Any suggestions?

推荐答案

您的问题是您需要处理所有问题.您需要确定用户单击的位置以调整大小,在单击该位置时捕获鼠标,直到他们抬起按钮,然后在移动窗体时在代码中调整窗体的大小.这并不是很困难,但这不是一步一步的过程.我认为最困难的部分将是确定您单击并拖动以调整大小的逻辑.
Your problem is that you need to deal with everything. You need to decide where the user clicks to resize, capture the mouse when they click there, until they raise the button, then resize your form in code as they move it. It''s not terribly difficult, but it''s not a one step process. I think the hard part will be working out the logic for where you click and drag to resize.


感谢您的回复.

是的,目前我只能通过结合屏幕尺寸使用顶部,左侧,宽度和高度属性,在单击圆的顶部,底部,左侧和右侧边缘时调整其大小.

我不知道当用户单击其他任何位置时如何调整表单的大小.
我还希望它能够同时调整宽度和heigt的大小,就像从角落调整法线形状的大小一样.

不知道从哪里开始
Thanks for your response.

Yeah at the moment i can only resize it when clicking on the top,bottom, left and right edges of the circle by using the top,left,width and height propertie in conjuction with the screen size.

I have no idea how to resize the form when the user clicks anywhere else.
I also want it to be able to resize both the width and heigt at the same time like when you resize a normal form from the corners.

Don''t know where to start


这篇关于调整圆形的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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