您的批评和鼓励都是我把编程无限办好的动力! 您编程时遇到困难,或遇到不顺心的事想发发牢骚尽管到这里来吧! 虽然本网力求全面,但也不能包罗万象,这些我筛选出的优秀网站连接就是对本站最好的补充! 学习编程当然也离不开书本了,这里收集大量编程书籍! 编程无限之源码超市,这里收集的代码令你意想不到的全面! 欢迎光临编程网校,这里专门收集VB/CB入门文章及技术文章! 欢迎光临编程无限!
     
       
 
当前位置:英文资料 >> Interface
Irregularly Shaped Forms & Forms With Holes
  资料类型: Interface 上传时间: 2001-02-21 阅读次数: 1164



Irregularly Shaped Forms & Forms With Holes
Forms that have shapes that do not resemble the standard rectangular shape are known as Irregular forms. Irregular forms may be round, elliptical, have holes in them or may be shaped like an n-sided polygon. Irregular forms can be used as attention grabbers or to create hot spots on forms.

This sample illustrates how to create several irregular forms and controls. As shown, you can make your form look like an ellipse with elliptical buttons and textboxes or you can round the corners of your form or even create holes in your forms.



To create the elliptical form and controls the CreateEllipticRgn API function is used. Simply pass in the handle of the form or control and specify the top, left, right and bottom coordinates of the ellipse. Then call SetWindowRgn to set the window region. The window region is the area within the window (form or control) where the operating system permits drawing. The operating system does not display any portion of a window that lies outside of this region.



To round the corners of the form the CreatePolygonRgn API is utilized. This function takes in an array of points (x and y coordinates) and plays connect the dots. The array of points can specify just about any shape - just let your imagination be your guide. Windows must be able to trace the points in a continuous fashion.

With a little trial and error you can even create holes in your forms. The above form was over an Explorer window. To create a hole begin on the outside of the form and then set a point inside the form. Now begin tracing the shape of the hole. When you are done with the hole make sure you return to the outside of the form along the exact same path you used to enter the hole. Once back on the outside of the form, continue specifying points around the form's perimeter. You should set the form's ScaleMode property to vbPixel. Remember, the top left corner of the form is at point (0,0).

Once you have your array of points, call the SetWindowRgn API to tell Windows how to draw the form.

For added flash, you can flash the title bar of your form. If you are running Windows 95 or NT 4 I use the FlashWindow API to toggle the title bar from activated to non-activated and vice versa. To continuously toggle the caption, a timer is used. If you are running Windows 98 or 2000 you will see a yellow circle between the form's two button. Clicking on the circle (really a round frame control) will display a popup menu. You will have choices to flash the title 5 times or continuously. To do this the FlashWindowEx funtion is used.

For the "mother of all attention grabbers," you can create forms that look like this. Here are nine forms in the shape of letters. To make them look a little fancier, I made their backgrounds a gradient color which changes every second or so. You can use this technique to make eye catching splash screens. I turned of the title bars on these forms to enhance their look. If you need to move a form with no title bar, see my Move a Form With No Title Bar example.

推荐给朋友 点 评( 0 ) 返回前页 关闭此页
   
  本类最热文章排名:
  1.Minimize All Windows to Show Desktop
2.Setting Video Resolu...
3.Create An Active Skin
4.Make MDI Child Forms Act Modal
5.clear all text in the form
6.Disable Enable the C...
7.Passing A Variable To A Form
8.Creates A form contr...
9.Gradient Color Trans...
10.Tile A Bitmap Accross A Form
   
   
  评论:
 
 
 

 

关于本站 版权声明 联系方法
编程无限 V4.1 Copyright © 1999-2008 21code.com

京ICP备05006938号