如何在vb.net 2008中创建不同类型的表单形状? [英] how to create a different type of shapes of forms in vb.net 2008?

查看:78
本文介绍了如何在vb.net 2008中创建不同类型的表单形状?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很动弹.....
我想在vb.net 2008中创建Windows窗体应用程序. 我想创建一个圆形窗口....
我该怎么办??
任何人都可以帮助我吗?
任何人都可以给我某种想法...

i am in really truble.....
i want to create a windows form application in vb.net 2008..
i want to create a circle shape window....
how can i do it???
Any one can Help me???
Some type of idea can any one give me......

推荐答案

您可以通过在Form_load事件或事件
you can easily create it by using given code at Form_load event or in Form_Paint event
Me.FormBorderStyle = FormBorderStyle.None
Dim graphicsPath As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath
graphicsPath.AddEllipse(Me.ClientRectangle)
Dim region As Region = New Region(graphicsPath)
Me.Region = region


简单的例子是
The simple example would be
private void Form2_Paint(object sender, PaintEventArgs e)
 {
     GraphicsPath path = new GraphicsPath();
     path.AddEllipse(150f, 150f, 300f, 300f);
     e.Graphics.FillPath(Brushes.AliceBlue, path);
     Region rgn = new Region(path);
     e.Graphics.Clip = rgn;
     this.Region = rgn;
     path.Dispose();
     rgn.Dispose();
 }



这是不可拖动的.您需要实现该功能.以同样的方式关闭,必须最小化按钮.



This is not draggable. You need to implement that functionality. Same way close, minimize buttons has to be add.


购买为什么? Windows即将为应用程序提供标准外观(并在一定程度上提供了标准功能集).当您开始四处寻找东西时,用户会感到沮丧,然后生气.

但是,如果您坚持要这样做,请按照以下一般步骤进行操作,我将留给您的高级谷歌搜索技能来了解如何执行每个步骤:

0)在您喜欢的图形程序中创建想要的形状/颜色的图像.

1)将新图像设置为表单的背景.

2)隐藏表单的各种标题栏按钮,并将边框更改为None.

3)创建/定位/连接您自己的图形按钮,以替换通常在标题栏中看到的按钮.

4)使用所需的控件填充您的.

您可能需要做其他事情,但是我再次想这是一个坏主意.您将如何对待/重新设计滚动条?其他控件的形状如何?您要留下完美的正方形角吗?如何使用用户在Windows主题设置中设置的颜色?您几乎必须忽略这些.

看?好主意...
Buy why? Windows came about to give a standard appearance (and to a certain extent, a standard feature set) to applications. When you start monkeying around with stuff, users get frustrated, and then angry.

However, if you insist of pursuing this, here are the general steps, and I leave it to your superior googling skills to find out how to do perform each step:

0) Create an image in your favorite graphics program that is the shape/color you desire.

1) Set the new image as the background of your form.

2) Hide the form''s various titlebar buttons, and change the border to None.

3) Create/position/wire-up your own graphical buttons to replace the ones that would normally be seen in the titlebar.

4) Populate your for with the desired controls.

You may have to do other things, but once again, I think this is a BAD idea. How are you going to treat/redesign scroll bars? How about the shapes of other controls? Are you going to leave them with perfectly square corners? How about using colors the user sets in his Windows theme settings? You''re going to pretty much have to ignore those.

See? Bad idea...


这篇关于如何在vb.net 2008中创建不同类型的表单形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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