[C ++] Use the ActiveX control in C ++ Builder to display Flash animation

xiaoxiao2021-03-06  42

Use the ActiveX control in C Builder to display Flash animation

Under Microsoft's strong support, more and more software companies began to support Activex, which is a very happy thing for friends who like to programmatically! Because we can easily call external OCX files in the program to implement complex features (Bill Gates, I finally do a good thing), such as calling IE in your program to display HTML files. Today I want to introduce you to how to use the ActiveX control in C Builder to display Flash animations. 1. Installation, import ActiveX control This protagonist this article is: swflash.ocx, this file Windows 98 comes with, in the default mode, Windows will be installed to the "Windows / System / Macromed / Flash" directory if you are installed No "Default Installation" can be found in the Win98_68.cab file in the Win98 installation CD file. C Builder can be very good to support ActiveX support, we can easily import ActiveX controls in the system: Select "Component-> Import ActiveX Control", select "ShockWave Flash" in the list above 1.0) "(Figure 1), then click the" Install "button below! If there is no in the list, then the ShockWave Flash control has not been registered in the system, don't tighten, we can click "Add" button to find this OCX file in your computer, and C Builder will automatically register it. 2. After programming the flash animation introduction, C Builder adds a "ShockWaveflash" control (Figure 2) to the ActiveX page (Figure 2) to create a new project, place a ShockWaveFlash control in the right location, adjust its size, then In its "movie" attribute, fill in a flash animation file name (such as c: /flash/test.swf) on your hard disk, then press F9 to run, how, do not write a line of code, we will make A program that displays flash animation! However, in order to make it better, we must also understand the properties and methods of the ShockWaveFlash control:

[Property] AlignMode (INT) and SALIGN (WideString type) Control the display position of the animation (listed in the two attributes), which means they are interrelated, change another one will change accordingly, and similar situations Not explained). The range and meanings are as follows: 0 empty current position 1 l The current position Left 2 R The current position is left to the right 3 LR Current position 4 T Current position on the upper left 6 TR upper right 7 LTR Above the upper 8 b Current position 9 LB left 10 RB Right 11 lrb under the lower right 12 TB Current position vertical cord 13 LTB leaning against left vertical 4 TRB Right vertical 1 15 LTRB Central location [Property] BackgroundColor (int "and BGColor (WideString type) Set background color BackgroundColor is an integer value, BGColor is its HEX string. [Property] Loop (BOOL) Whether the [Property] MENU (BOOL) is displayed to display the right-click menu, it is recommended to set it to True because it can complete most of the control work for Flash animation, without writing code. [Property] Movie (WideString) Flash animation file name, can be dynamically set in operation, turn off an animation, just set it to empty. [Property] Quality (int type) and Quality2 (WideString type) Control the display quality of the animation, generally set Quality to 1 to obtain high quality display effect. [Property] Scalemode and Scale (WideString type) Control the display ratio, value range and meanings as follows: 0 Showll Display all 1 noborder boundless box mode 2 Exactfit stretch to the entire screen 3 empty original size [method] PercentLoaded Returns the percentage of animation that has been loaded, and you can create a process bar to display the movie load. [Method] LoadMovie is used to load an animation on the network. The animation file is named a BSTR-type URL value, and the C Builder can be converted to a BSTR type with the Ansitoolestr function in C Builder. Ok, use the properties and methods described above, I believe that you have used it very well! Unfortunately, the features of the Shockwaveflash control are now not perfect, such as that cannot return the actual size and background color of the animation, but for us to display a specific Flash animation in the program, these are not important.

转载请注明原文地址:https://www.9cbs.com/read-47544.html

New Post(0)