Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use VB to realize the graphic special effect of blinds

Shulou Source: shulou.com Published: 2022-06-03 09:27:17 10月02日 Update

Editor to share with you how to use VB to achieve blinds graphics special effects, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

In software like Powerpoint, a variety of graphic special effects emerge one after another, among which the switching effect of "blinds" is particularly novel and strange. It is very simple and convenient to realize such graphic special effects in VB. The way to do this is to call WINDOWS's API function Bitblt. BitBlt function is similar to the combined use of getimage and putimage functions in C language. BitBlt originally means "Bit Block Transfer", and its main purpose is to copy bitmaps. Use BitBlt function to show graphics special effects, the principle is very simple, the production of first in the form to draw two picture frames, the picture into a picture frame, while the other picture frame is set to empty, and then call the BitBlt function to copy part of the first picture frame graphics to the second picture frame, so you can achieve strange graphics special effects.

Create a new form in the VB environment, draw two picture boxes picSour and picDest, and two command buttons cmdShow and cmdExit. First of all, declare the BitBlt function as the required constant name in the general process of the form, load the picture in the picSour while loading the form, and call the BitBlt function in the event of the button cmdShow. The procedure is as follows:

The API function declaration:

Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer,ByVal X As Integer,ByVal Y As Integer,ByVal nWidth AS Integer,ByVal nHeight As Integer,ByVal hSrcDC As Integer,ByVal xSrc As Integer,ByVal ySrc As Integer,ByVal dwRop As Long) As Integer

One of the 15 algorithms of Const COPY-PUT=&HCC0020'BitBlt, which represents direct copy

Load pictures:

Sub Form-Load ()

Picsour.Picture=LoadPicture ("c:\ windows\ LEAVES.bmp")

Picsour.ScaleMode=3' is in pixels

End Sub

Displays the switching effect of the blinds:

Sub Comshow-Click ()

H%=picsour.ScaleHeight

W%=picsour.ScaleWidth

Scanlines=4

For iTun0 To (scanlines-1)

For junii To H% Step scanlines

S% percentage BitBlt% (picdest.hDC,0,j,W%,1,picsour.hDC,0,j,copy-Put)

Delay 500' delay

Next j

Next i

End Sub

Among them, delay is a general subprocess, which is used to delay time so that the switching effect can be seen clearly. The code is as follows:

Sub delay (delaytime As Integer)

For iTunes 1 To delaytime

Next i

End Sub

Through such a simple program can achieve "blinds" switch special effects, in fact, as long as there is a suitable algorithm, the use of BitBlt function can achieve graphic special effects is endless.

The above is all the contents of the article "how to use VB to achieve the graphic special effects of blinds". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Functions pictures graphics special effects blinds blinds two toggle effects forms articles content at the same time buttons programs algorithms procedures appropriate novel strange Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Xiaomi Shulou Tech Info MySQL