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:
- Procedure tcustomcontrolbar. paintcontrolframe (canvas: TCanvas; acontrol: tcontrol;
- VaR arect: trect );
- Const
- Offset = 3;
- VaR
- R: trect;
- Elemdetails: tthemedelementdetails;
- Options: tbandpaintoptions;
- Procedure drawgrabber;
- Begin
- With canvas, r do
- Begin
- Pen. Color: = clbtnhighlight;
- MoveTo (R. Left + 2, R. Top );
- Lineto (R. Left, R. Top );
- Lineto (R. Left, R. Bottom + 1 );
- Pen. Color: = clbtnshadow;
- MoveTo (R. Right, R. Top );
- Lineto (R. Right, R. Bottom );
- Lineto (R. Left, R. Bottom );
- End;
- End;
- Begin
- If fdrawingstyle = dsgradient then
- Options: = [bpograbber, bpogradient, bporoundrect]
- Else
- Options: = [bpograbber, bpoframe];
- Dobandpaint (acontrol, canvas, arect, options );
- With canvas do
- Begin
- If bpoframe in options then
- Drawedge (handle, arect, bdr_raisedinner, bf_rect );
- If bporoundrect in options then
- Begin
- Beginpath (handle );
- Polyline ([point (arect. Left + INTEGER (corneredge), arect. Top ),
- Point (arect. Right-INTEGER (corneredge), arect. Top), {top line}
- Point (arect. Right, arect. Top + INTEGER (corneredge), {top right curve}
- Point (arect. Right, arect. Bottom-INTEGER (corneredge), {right side line}
- Point (arect. Right-INTEGER (corneredge), arect. Bottom), {bottom right curve}
- Point (arect. Left + INTEGER (corneredge), arect. Bottom), {bottom line}
- Point (arect. Left, arect. Bottom-INTEGER (corneredge), {bottom left curve}
- Point (arect. Left, arect. Top + INTEGER (corneredge), {left side line}
- Point (arect. Left + INTEGER (corneredge), arect. Top)]); {top left curve}
- Endpath (handle );
- {Clips the canvas to our roundrect drawn abve using polyline}
- Selectclippath (handle, rgn_copy );
- End;
- If bpogradient in options then
- Begin
- {This gradient is actually the border gradient}
- Gradientfillcanvas (canvas, gethighlightcolor (gradientstartcolor ),
- Getshadowcolor (gradientendcolor), arect, gradientdirection );
- R: = arect;
- Inflaterect (R,-Pen. Width,-Pen. width );
- {The gradient of the band}
- Gradientfillcanvas (canvas, gradientstartcolor, gradientendcolor,
- R, gradientdirection );
- End;
- If bpograbber in options then
- Begin
- If themeservices. themesenabled then
- Begin
- Elemdetails: = themeservices. getelementdetails (trgripper );
- R: = rect (arect. Left + 2, arect. Top + 2, arect. Left + 5 + 2, arect. Bottom-3 );
- Themeservices. drawelement (canvas. Handle, elemdetails, R );
- End else
- Begin
- R: = rect (arect. Left + offset, arect. Top + 2, arect. Left + Offset + 2,
- Arect. Bottom-3 );
- Drawgrabber;
- End;
- End;
- End;
- 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!