Today's programming scripts

Source: Internet
Author: User
Tags polyline
The relationship between the tcontrolbar: onpaint event and onbandpaint is procedure tcustomcontrolbar. paint; --> onpaint (Self); --> for I: = 0 to fitems. count-1 do --> paintcontrolframe (canvas, control, R); --> dobandpaint (acontrol, canvas, arect, options); --> onbandpaint (self, control, canvas, arect, options); The onpaint event is first released to the entire tcontrolbar. Onbandpaint is only one band at the end. Of course, onpaint cannot determine what it draws but what it does not, while onbandpaint can change options to determine what it can paint. If themesp is not enabled for windows, the vertical line drawn by tcontrolbar is indeed unsightly, especially when bpogradient is used, but you can refer to tcustomcontrolbar. paintcontrolframe to draw one by yourself. Code for tcustomcontrolbar. paintcontrolframe:
  1. Procedure tcustomcontrolbar. paintcontrolframe (canvas: TCanvas; acontrol: tcontrol;
  2. VaR arect: trect );
  3. Const
  4. Offset = 3;
  5. VaR
  6. R: trect;
  7. Elemdetails: tthemedelementdetails;
  8. Options: tbandpaintoptions;
  9. Procedure drawgrabber;
  10. Begin
  11. With canvas, r do
  12. Begin
  13. Pen. Color: = clbtnhighlight;
  14. MoveTo (R. Left + 2, R. Top );
  15. Lineto (R. Left, R. Top );
  16. Lineto (R. Left, R. Bottom + 1 );
  17. Pen. Color: = clbtnshadow;
  18. MoveTo (R. Right, R. Top );
  19. Lineto (R. Right, R. Bottom );
  20. Lineto (R. Left, R. Bottom );
  21. End;
  22. End;
  23. Begin
  24. If fdrawingstyle = dsgradient then
  25. Options: = [bpograbber, bpogradient, bporoundrect]
  26. Else
  27. Options: = [bpograbber, bpoframe];
  28. Dobandpaint (acontrol, canvas, arect, options );
  29. With canvas do
  30. Begin
  31. If bpoframe in options then
  32. Drawedge (handle, arect, bdr_raisedinner, bf_rect );
  33. If bporoundrect in options then
  34. Begin
  35. Beginpath (handle );
  36. Polyline ([point (arect. Left + INTEGER (corneredge), arect. Top ),
  37. Point (arect. Right-INTEGER (corneredge), arect. Top), {top line}
  38. Point (arect. Right, arect. Top + INTEGER (corneredge), {top right curve}
  39. Point (arect. Right, arect. Bottom-INTEGER (corneredge), {right side line}
  40. Point (arect. Right-INTEGER (corneredge), arect. Bottom), {bottom right curve}
  41. Point (arect. Left + INTEGER (corneredge), arect. Bottom), {bottom line}
  42. Point (arect. Left, arect. Bottom-INTEGER (corneredge), {bottom left curve}
  43. Point (arect. Left, arect. Top + INTEGER (corneredge), {left side line}
  44. Point (arect. Left + INTEGER (corneredge), arect. Top)]); {top left curve}
  45. Endpath (handle );
  46. {Clips the canvas to our roundrect drawn abve using polyline}
  47. Selectclippath (handle, rgn_copy );
  48. End;
  49. If bpogradient in options then
  50. Begin
  51. {This gradient is actually the border gradient}
  52. Gradientfillcanvas (canvas, gethighlightcolor (gradientstartcolor ),
  53. Getshadowcolor (gradientendcolor), arect, gradientdirection );
  54. R: = arect;
  55. Inflaterect (R,-Pen. Width,-Pen. width );
  56. {The gradient of the band}
  57. Gradientfillcanvas (canvas, gradientstartcolor, gradientendcolor,
  58. R, gradientdirection );
  59. End;
  60. If bpograbber in options then
  61. Begin
  62. If themeservices. themesenabled then
  63. Begin
  64. Elemdetails: = themeservices. getelementdetails (trgripper );
  65. R: = rect (arect. Left + 2, arect. Top + 2, arect. Left + 5 + 2, arect. Bottom-3 );
  66. Themeservices. drawelement (canvas. Handle, elemdetails, R );
  67. End else
  68. Begin
  69. R: = rect (arect. Left + offset, arect. Top + 2, arect. Left + Offset + 2,
  70. Arect. Bottom-3 );
  71. Drawgrabber;
  72. End;
  73. End;
  74. End;
  75. End;

Get rid of the drawgrabber above and draw whatever you like. Of course, it is recommended to draw in the onbandpaint event, instead of modifying the control code.

Then the tdbcomboboxeh: ehlib control is good, but there are always some problems, such as connecting the control to a Boolean field and Writing false and true in keyitems. What is the result? The drop-down list can be displayed, and can also be updated to the database, but the control itself is displayed blank. After turning over the code, it used to use keyitems. indexof (fdatalink. field. text) to find (in the getdisplaytextforpaintcopy function), Boolean field. text is false and true (uppercase). After correction, everything is normal. Abstract error: after a large number of control types on the interface are replaced (directly change the DFM file), run the program to report abstract error and check it to find out, previously, activecontrol was specified for form, and the control has been converted to tdbtext ~~~~~ Fastreport: 4.7.3 already exists, but the project is too tight to update the control now. Toad data modeler Library: After case studio is sold, it is replaced by the toad data modeler library. After reading the materials, it has changed a lot and its functions have been improved a lot. I am afraid to use it immediately. After the project is finished, I will try again. Finally, db4o: The last o is the object. It is an object-oriented open-source database that supports Java and. net. It complies with the GPL Protocol and is free of charge !!! Go to Google if you are interested! Personal notes, reject reprinting!

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.