Winapi: drawframecontrol-draw Control

Source: Internet
Author: User
// Declaration: drawframecontrol (DC: HDC; {Device environment handle} const rect: trect; {rectangle} utype, ustate: uint {control type and control status}): bool; // optional value of the control type utype parameter: dfc_caption = 1; {Title button} dfc_menu = 2; {menu} dfc_scroll = 3; {scroll bar button} dfc_button = 4; {standard button} dfc_popupmenu = 5; {pop-up menu} // optional value of the control state ustate parameter: {for dfc_caption} dfcs_captionclose = 0; dfcs_captionmin = 1; dfcs_captionmax = 2; dfcs_captionrestore = 3; dfcs_captionhelp = 4; {for dfc_menu} rows = 0; dfcs_menucheck = 1; rows = 2; rows = 4; {for dfc_scroll} rows = 0; dfcs_scrolldown = 1; dfcs_scrollleft = 2; dfcs_scrollright = 3; dfcs_scrollcombobox = 5; bytes = 8; bytes = $10; {for dfc_button} dfcs_buttoncheck = 0; dfcs_buttonradioimage = 1; bytes = 2; response = 4; dfcs_button3state = 8; dfcs_buttonpush = $10; {General Status} dfcs_inactive = $100; dfcs_pushed = $200; dfcs_checked = $400; dfcs_transparent = $800; dfcs_hot = $1000; dfcs_adjustrect = $2000; dfcs_flat = $4000; dfcs_mono = $8000;
 // Example: Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) radiogroup1: tradiogroup; groups: tradiogroup; radiogroup4: tradiogroup; groups: tradiogroup; radiogroup6: tradiogroup; Panel1: tpanel; Procedure alert (Sender: tobject); Procedure alert (Sender: tobject); Procedure pull (Sender: tobject); Procedure radiogroup4click (Sender: tobject); Procedure pull (Sender: tobject); Procedure draw; end; vaR form1: tform1; implementation {$ R *. DFM} var DFC: integer = 0; dfcs1: integer = 0; dfcs2: integer = 0; Procedure tform1.draw; begin panel1.refresh; drawframecontrol (getdc (panel1.handle), rect (10, 10, 100,50), DFC, dfcs1 or dfcs2); end; Procedure submit (Sender: tobject); begin groups; Case radiogroup1.itemindex of 0: Begin DFC: = dfc_caption; radiogroup3.enabled: = true; enabled: = false; radiogroup5.enabled: = false; radiogroup6.enabled: = false; end; 1: Begin DFC: = dfc_menu; radiogroup3.enabled: = false; radiogroup4.enabled: = true; radiogroup5.enabled: = false; radiogroup6.enabled: = false; end; 2: Begin DFC: = dfc_scroll; radiogroup3.enabled: = false; radiogroup4.enabled: = false; radiogroup5.enabled: = true; radiogroup6.enabled: = false; end; 3: begin DFC: = dfc_button; radiogroup3.enabled: = false; radiogroup4.enabled: = false; radiogroup5.enabled: = false; radiogroup6.enabled: = true; end; 4: Begin DFC: = enabled; radiogroup3.enabled: = false; radiogroup4.enabled: = true; radiogroup5.enabled: = false; radiogroup6.enabled: = false; end; Procedure success (Sender: tobject); begin case radiogroup2.itemindex of 0: dfcs1: = dfcs_inactive; 1: dfcs1: = success; 2: dfcs1: = dfcs_checked; 3: dfcs1: = dfcs_transparent; 4: dfcs1: = dfcs_hot; 5: dfcs1: = fail; 6: dfcs1: = dfcs_flat; 7: dfcs1: = dfcs_mono; end; draw; end; procedure merge (Sender: tobject); begin case radiogroup3.itemindex of 0: dfcs2: = dfcs_captionclose; 1: dfcs2: = dfcs_captionmin; 2: dfcs2: = dfcs_captionmax; 3: dfcs2: = Hangzhou; 4: dfcs2: = dfcs_captionhelp; end; draw; end; procedure merge (Sender: tobject ); begin case radiogroup4.itemindex of 0: dfcs2: = dfcs_menuarrow; 1: dfcs2: = dfcs_menucheck; 2: dfcs2: = dfcs_menubullet; 3: dfcs2: = begin; end; draw; End; procedure extract (Sender: tobject); begin case radiogroup5.itemindex of 0: dfcs2: = Hangzhou; 1: dfcs2: = Hangzhou; 2: dfcs2: = dfcs_scrollleft; 3: dfcs2: = dfcs_scrollright; 4: dfcs2: = dfcs_scrollcombobox; 5: dfcs2: = dfcs_scrollsizegrip; 6: dfcs2: = Hangzhou; end; draw; end; Procedure tform1.radiogroup6click (Sender: tobject ); begin case radiogroup6.itemindex of 0: dfcs2: = dfcs_buttoncheck; 1: dfcs2: = Hangzhou; 2: dfcs2: = Hangzhou; 3: dfcs2: = Hangzhou; 4: dfcs2: = dfcs_button3state; 5: dfcs2: = dfcs_buttonpush; end; draw; end.
 //:


<Br/> Attached Form Structure Code: </P> <p> Object form1: tform1 <br/> left = 0 <br/> Top = 0 <br/> caption = 'form1 '<br/> clientheight = 386 <br/> clientwidth = 499 <br /> color = clbtnface <br/> font. charset = default_charset <br/> font. color = clwindowtext <br/> font. height =-11 <br/> font. name = 'tahoma '<br/> font. style = [] <br/> oldcreateorder = false <br/> pixelsperinch = 96 <br/> textheight = 13 <br/> Object radiogroup1: tradiogroup <br/> left = 0 <br/> Top = 8 <br/> width = 137 <br/> Height = 129 <br/> caption = 'radiogroup1' <br /> items. strings = (<br/> 'dfc _ caption '<br/> 'dfc _ call' <br/> 'dfc _ scroll' <br/> 'dfc _ callback' <br/> 'dfc _ popupmenu ') <br/> taborder = 0 <br/> onclick = radiogroup1click <br/> end <br/> Object radiogroup2: tradiogroup <br/> left = 0 <br/> Top = 143 <br/> width = 137 <br/> Height = 170 <br/> caption = 'radiogroup2' <br /> items. strings = (<br/> 'dfcs _ inactivity' <br/> 'dfcs _ pushed' <br/> 'dfcs _ checked' <br/> 'dfcs _ transparent' <br/> 'dfcs _ hot '<br/> 'dfcs _ adjustrect' <br/> 'dfcs _ flat' <br/> 'dfcs _ mono ') <br/> taborder = 1 <br/> onclick = radiogroup2click <br/> end <br/> Object radiogroup3: tradiogroup <br/> left = 143 <br/> Top = 8 <br/> width = 178 <br/> Height = 129 <br/> caption = 'radiogroup3' <br /> items. strings = (<br/> 'dfcs _ captionclose' <br/> 'dfcs _ captionmin '<br/> 'dfcs _ captionmax' <br/> 'dfcs _ captionrestore' <br/> 'dfcs _ captionhelp ') <br/> taborder = 2 <br/> onclick = radiogroup3click <br/> end <br/> Object radiogroup4: tradiogroup <br/> left = 327 <br/> Top = 8 <br/> width = 170 <br/> Height = 129 <br/> caption = 'radiogroup4' <br /> items. strings = (<br/> 'dfcs _ menuarrow' <br/> 'dfcs _ menucheck' <br/> 'dfcs _ menubullet '<br/> 'dfcs _ menuarrowright ') <br/> taborder = 3 <br/> onclick = radiogroup4click <br/> end <br/> Object radiogroup5: tradiogroup <br/> left = 143 <br/> Top = 143 <br/> width = 178 <br/> Height = 170 <br/> caption = 'radiogroup5' <br /> items. strings = (<br/> 'dfcs _ scrollup' <br/> 'dfcs _ scrolllow' <br/> 'dfcs _ scrollleft' <br/> 'dfcs _ scrollright' <br/> 'dfcs _ scrollcombobox' <br/> 'dfcs _ scrollsizegrip '<br/> 'dfcs _ scrollsizegripright ') <br/> taborder = 4 <br/> onclick = radiogroup5click <br/> end <br/> Object radiogroup6: tradiogroup <br/> left = 327 <br/> Top = 143 <br/> width = 170 <br/> Height = 170 <br/> caption = 'radiogroup6' <br /> items. strings = (<br/> 'dfcs _ buttoncheck' <br/> 'dfcs _ buttonradioimag' <br/> 'dfcs _ buttonradiomask '<br/> 'dfcs _ buttonradio' <br/> 'dfcs _ button3state' <br/> 'dfcs _ buttonpush ') <br/> taborder = 5 <br/> onclick = radiogroup6click <br/> end <br/> Object Panel1: tpanel <br/> left = 0 <br/> Top = 319 <br/> width = 499 <br/> Height = 67 <br/> align = Albottom <br/> caption = 'panel1' <br/> taborder = 6 <br/> end <br/>
Related Article

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.