Gdiplus draws text with transparent channels

Source: Internet
Author: User
  1. [LIST]
  2. [*] Private sub form_load ()
  3. [*] Initgdiplus
  4. [*]
  5. [*] Dim membmp as long, memgraphics as long
  6. [*] Createbitmapwithgraphics membmp, memgraphics, 200,100, pixelformat32bppargb
  7. [*]
  8. [*] Dim gfontfamily as long, gfont as long, gstrfmt as long
  9. [*] Gdipcreatefontfamilyfromname strptr (""), 0, gfontfamily
  10. [*] Gdipcreatefont gfontfamily, 13, fontstyle. fontstyleregular, unitpixel, gfont
  11. [*] Gdipcreatestringformat 0, 0, gstrfmt
  12. [*] Gdipsetstringformatalign gstrfmt, stringalignmentnear
  13. [*]
  14. [*] Dim RC as rectf
  15. [*] Dim brush as long
  16. [*] Gdipcreatesolidfill & hff0000ff, brush
  17. [*]
  18. [*] 'Test cleartype first
  19. [*] Gdipsettextrenderinghint memgraphics, textrenderinghintcleartypegridfit
  20. [*] Gdipdrawstring memgraphics, strptr ("cleartype text"),-1, gfont, RC, gstrfmt, and brush
  21. [*]
  22. [*] RC. Top = 20
  23. [*] 'Test antialias gridfit
  24. [*] Gdipsettextrenderinghint memgraphics, textrenderinghintantialiasgridfit
  25. [*] Gdipdrawstring memgraphics, strptr ("antialias gridfit text"),-1, gfont, RC, gstrfmt, and brush
  26. [*]
  27. [*] RC. Top = 40
  28. [*] 'Test antialias
  29. [*] Gdipsettextrenderinghint memgraphics, textrenderinghintantialias
  30. [*] Gdipdrawstring memgraphics, strptr ("antialias text"),-1, gfont, RC, gstrfmt, brush
  31. [*]
  32. [*] RC. Top = 60
  33. [*] 'Test singlebitperpixel gridfit
  34. [*] Gdipsettextrenderinghint memgraphics, textrenderinghintsinglebitperpixelgridfit
  35. [*] Gdipdrawstring memgraphics, strptr ("singlebitperpixel gridfit text"),-1, gfont, RC, gstrfmt, brush
  36. [*]
  37. [*] RC. Top = 80
  38. [*] 'Test singlebitperpixel
  39. [*] Gdipsettextrenderinghint memgraphics, textrenderinghintsinglebitperpixel
  40. [*] Gdipdrawstring memgraphics, strptr ("singlebitperpixel text"),-1, gfont, RC, gstrfmt, and brush
  41. [*]
  42. [*] Dim frmgraphics as long
  43. [*] Gdipcreatefromhdc HDC, frmgraphics
  44. [*] Gdipgraphicsclear frmgraphics, & hffffffff
  45. [*]
  46. [*] Gdipsettextrenderinghint frmgraphics, textrenderinghintcleartypegridfit
  47. [*] RC. Top = 10
  48. [*] RC. Left = 10
  49. [*] Gdipdeletebrush
  50. [*] Gdipcreatesolidfill & hff000000, brush
  51. [*] Gdipdrawstring frmgraphics, strptr ("draw a bitmap containing transparent channels:"),-1, gfont, RC, gstrfmt, and brush
  52. [*]
  53. [*] Gdipdrawimagerecti frmgraphics, membmp, 10, 40,200,100
  54. [*]
  55. [*] Gdipdeletebrush
  56. [*] Gdipdeletestringformat gstrfmt
  57. [*] Gdipdeletefont gfont
  58. [*] Gdipdeletefontfamily gfontfamily
  59. [*] Gdipdeletegraphics frmgraphics
  60. [*] Gdipdeletegraphics memgraphics
  61. [*] Gdipdisposeimage membmp
  62. [*]
  63. [*] Terminategdiplus
  64. [*] End sub
  65. [*]

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.