Thoughts on display blank lyrics-Reply to "zhaoboaidelphi"

Source: Internet
Author: User
Problem Source: http://www.cnblogs.com/del/archive/2009/12/22/1629717.html#2096734
1. Use transparentcolor and transparentcolorvalue to specify a transparent color for the form;

2. Draw non-transparent text and use tlabel to present the text;

3. process the wm_nchittest message so that the form can be dragged;

4. Use the ESC key to exit.

Test Code :
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) timer1: ttimer; procedure formcreate (Sender: tobject); Procedure submit (Sender: tobject); Procedure formkeypress (Sender: tobject; var key: Char); private protected procedure publish (VAR message: twmnchittest ); message wm_nchittest; public end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.formcreate (Sender: tobject); begin formstyle: = fsstayontop; borderstyle: = bsnone; transparentcolor: = true; transparentcolorvalue: = color; font. size: = 72; font. name: = 'arial black'; // doublebuffered: = true; end; Procedure tform1.formkeypress (Sender: tobject; var key: Char); begin if key = CHR (27) then close; end; Procedure tform1.timer1timer (Sender: tobject); var STR: string; begin STR: = timetostr (now); clientwidth: = canvas. textwidth (STR); clientheight: = canvas. textheight (STR); canvas. lock; canvas. brush. color: = color; canvas. fillrect (clientrect); canvas. brush. style: = bsclear; canvas. font. color: = clblack; canvas. textout (1, 1, STR); canvas. font. color: = clred; canvas. textout (0, 0, STR); canvas. brush. style: = bssolid; canvas. unlock; end; Procedure tform1.wmnchittest (VAR message: twmnchittest); Begin message. result: = htcaption; end.

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.