Use APIs to implement string Images

Source: Internet
Author: User

Using APIs to implement string images (1)

Private declare function stretchblt lib "GDI32" (byval HDC as long, byval X as long, byval y as long, byval nwidth as long, byval nheight as long, byval hsrcdc as long, byval xsrc as long, byval ysrc as long, byval nscwidth as long, byval nscheight as long, byval dwrop as long) as long
Private const srccopy = & hcc0020
Private withevents pic1 as picturebox
Private withevents pic2 as picturebox

Sub form_load ()
Me. Move 0, 0, 10200,400 0
Set pic1 = controls. Add ("VB. picturebox", "pic1", me)
Pic1.visible = true
Pic1.move 0, 0, 5000,250 0
Set pic2 = controls. Add ("VB. picturebox", "pic2", me)
Pic2.visible = true
Pic2.move 5000, 0, 5000,250 0
Pic1.scalemode = 3
Pic2.scalemode = 3
End sub

Sub form_click ()
Pic2.CurrentX = 0
Pic2.CurrentY = 0
Pic2.FontSize = 120
Pic2.ForeColor = vbRed
Pic2.FontName = ""
Pic2.Print "image"
StretchBlt pic1.hdc, pic2.ScaleWidth, 0,-pic2.ScaleWidth, pic2.ScaleHeight, pic2.hdc, 0, 0, pic2.ScaleWidth, pic2.ScaleHeight, SRCCOPY
End Sub

Use APIs to implement string images (2)

 

Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, byVal xSrc As Long, ByVal ySrc As Long, ByVal nscwidth As Long, ByVal nscheight As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = & HCC0020
Private WithEvents pic1 As PictureBox

Sub Form_Load ()
Me. Move 0, 0, 11000,850 0
Set pic1 = Controls. Add ("vb. picturebox", "pic1", Me)
With pic1
. Visible = true
. Move 3600,270 0, 3600,270 0
. Scalemode = 3
. Appearance = 0
. Backcolor = me. backcolor
. Currentx = 0
. Currenty = 0
. Fontsize = 60
. Forecolor = vbblue
. Fontname = ""
End
End sub

Sub form_click ()
Dim w as integer, H as integer
Pic1.print "beginning of people" & vbcrlf & "Good Nature"
W = pic1.scalewidth
H = pic1.scaleheight
Stretchblt me. HDC, W, H,-W, H, pic1.hdc, 0, 0, W, H, srccopy
Stretchblt me. HDC, 3 * w, H,-W, H, pic1.hdc, 0, 0, W, H, srccopy
Stretchblt me. HDC, W, H, W,-h, pic1.hdc, 0, 0, W, H, srccopy
Stretchblt me. HDC, W, 3 * H, W,-h, pic1.hdc, 0, 0, W, H, srccopy
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.