Quick display of irregularities in C Builder
Tao Zhicai
The traditional Windows application interface gives people a feeling of thousands of right squares. It is always difficult to see some different general software interfaces. Today, a considerable number of commercial software is also more beautiful while providing excellent and powerful features, such as the interface plug-in in "Super Sacred 2000", and those used by their gorgeous appearance Full of good feelings. As a programming enthusiast, if you write, you also have a similar interface, you may attract more attention. So, we will start to make your own beautiful interface now. Technical insider wants to join the applications of irregularities in their own procedures, you must first be familiar with the use of several Windows API functions, they are: Elliptical (or circular) area creation function CreatellLipTicRGN, polygonal area creation function CreatePolygonRGN, Rectangular Area Creating a Function CreateRectrGN, creating a function CreateroundRectrgn with rounded rectangular area. You can use these functions to create different types of forms, or use the Windows API function combinergn to combine several simple areas into a complex area. The next step is to display the area that has been created on the screen, and the Windows API function is used, which is used this time the SETWINDOWRGN function. The Windows API function is defined in the Borland C Builder header file, which is like using these API functions in the application like a common library function using C . Preparing for your program to prepare a background picture, the recommended method is: Open the picture after Photoshop Use the magnetic rope tool to select the image outline you need - copy - New file (background usage white) - Paste - Save File (PSD File) - Use ACDSEE and so on to convert the saved PSD file to BMP file Face.BMP standby. As shown in the figure: The reference picture is filed in the program Open the Borland C Builder, placed on the form, and the Picture is time to be empty; put a popup menu on the form, edit menu item Add "close" item (add program code to make Turn off the application when the pop-up menu is activated. The procedure is processed as follows: void __fastcall tform1 :: formcreate (TOBJECT * Sender) {image1-> picture-> loadingfromfile (".// Face.bmp"); width = image1-> width; height = image1-> height; Repaint ();} At this point, the size of the form can be changed with the size of the picture used, but still is a traditional Windows interface. To display the form profile with a picture contour, you need to use the Windows API described above. The function will not need to display some of the display.
The image is a very simple method. It uses the way the picture is scanned, and the picture pixel point is part of the white part. The method used is: generate a pixel point near the pixel point. Rectangle, with the original picture, the original picture is removed, the procedure is as follows: hrgn recom (y = 0; Y The procedures are as follows: Register Int x, y; int L, r; Point * a; BOOL LB, RB; HRGN WNDRGN, TEMPRGN ,; IF ((a = (Point *) Malloc (800 * 2 * (Sizeof (Point) )) == NULL) {ShowMessage ("Request for Memory Failed!"); Exit (0);} l = 0; r = Image1-> Height * 2-1; WNDRGN = CreateRectrgn (0, 0, Image1-> Width , Image1-> height; for (y = 0; y The procedure is as follows: void __fastcall tform1 :: formcreate (TOBJECT * Sender) {Register INT X, Y; INT L, R; Point * a; BOOL LB, RB; HRGN WNDRGN, TEMPRGN, TEPRGN; Width = 800; Height = 600; IF ((a = (pointof)))) == null) {showMessage ("Apply for Memory Failed!"); exit (0);} Image1-> Picture-> LoadFromfile (".// Face.bmp"); width = image1-> width; height = image1-> height; repaint (); l = 0; r = image1-> height * 2-1; wNDRGN = CreateRectRGN (0 , IMage1-> width, image1-> height; / Application Method 2 Generate contour coordinate points in array for (y = 0; y