TToolBar: how to get rid of vertical bars? - delphi

When I have a TToolbar and I put non-toolbutton controls on it, there is a superfluous vertical bar through the control. How can I get rid of the bar?
In the image below, the toolbar contains only two toolbuttons and a TLabel and no separators. Notice the vertical bar through the letter V.

If I recall correctly, this is due to the handle of transparency of other non TToolButton controls that are placed in the TToolBar and, for this reason, if you set "Transparent" property of your TLabel to false, the vertical bar will disappear.

you may want to try JVCL component suites (free) Delphi Jedi. It has a lot of visual components, including all sorts of panels & buttons. They also have panel with gradient colors, and image buttton for examples.

Delphi XE2 Hot Update 4, Still got this bug, i work around this bug by :
Setting TLabel.Autosize := False;
TLabel.width := 50; --> just make sure its more than its caption, at least by 10 pixels
TLabel.Alignment := taRightJustify
Thanks.

Related

tPanels shown on top of Panel that contains tchart is transparent (Delphi)

I have a frame with a panel.
on the panel is a tchart graph and custom panel that overlays the graph (so it's on top of the graph, with the user toggling which one is showing).
Additionally, I have 3 other panels that contain text, that user also toggles visible/not visible.
the problem: starting in Delph 10.4, the panel is showing sections of the chart. the problem didn't exist in Delphi Seattle (and untested in 10.2 and 10.3), but in 10.4, I can't show the 3 panels without showing sections of the chart.
To replicate, add a panel to a form, put a chart on the panel. add a second panel to the form, not visible, with some text. add a right click menu to set the panel visible. sections of the chart are 'bleeding through' the panel. This also happens with group boxes.
this is what it looks like:
question is: how can I get the panels to show correctly?
How I want it to look:
I can reproduce this in Delphi 10.3 Rio
This happens only if the panel is added as child control of the TChart component and has its ParentBackground property enabled (enabled by default).
I'm guessing that TChart background is drawn with transparency at some level. And when ParentBackground property of any child component is enabled backgroud of such components is also drawn using transparency.
Disabling the ParentBackground property of your Panels will solve your problem.

How to scroll a TTabSheet

I'd like to scroll an individual TabSheet within a PageControl if the height of the sheet becomes less than a value.
If I put a ScrollBox on the TabSheet, the themed background of the TabSheet is not painted (it's overwritten by the single color background of the scrollbox).
I've been trying to find / create a transparent scrollbox component with no luck. Any other ideas?
I'm using Delphi 7.
Thanks!
To answer my own question, TMS has a transparent scrollbox component called "TAdvScrollBox" that works with themed tabsheets too:
http://www.tmssoftware.com/site/asb.asp
Maybe this will help somebody:
There is a small bug with the component that turns the ParentCtl3d property to false causing ListViews to be rendered with a black border instead of a 3d one. It's easy to fix by setting ParentCtl3d to true programmatically on FormCreate.

Delphi tbsSeparator TToolButton on a non-themed TToolBar with Flat style has a vertical line in the middle - how to fix it?

My question is related to this one:
Can Delphi themed toolbars have dividers that are centred between their tool buttons?
I have a Delphi 7 application where I have a TToolButton with Style = tbsSeparator on a TToolBar with Flat = True. Using the fix accepted in the question mentioned above, a tbsSeparator and a tbsDivider are drawn as expected if the toolbar is themed (i.e. if my application has a theme manifest (XPMan) and Windows themes is enabled on the system the application is running on).
However, if the application doesn't have a manifest or if the system doesn't have themes enabled, a tbsSeparator is drawn with a vertical line in the middle, slightly smaller than that of a tbsDivider:
On the screenshot, the one on the left is a tbsSeparator (it shouldn't have the line in the middle), the one on the right is a tbsDivider (that one's OK).
If I turn off the Flat style everything is OK, but I want the Flat style on a non-themed toolbar.
So, the question is how to have a tbsSeparator drawn without a vertical line in the middle on a non-themed TToolBar with Flat style?
Here is a quote from documentation:
The BTNS_SEP style creates a small gap between buttons or draws an
etch between buttons on flat toolbars. ...
It states, an etch is drawn on separators of flat toolbars. There's no mention of dependency on themes..

Why TPanel does not show correct frame/border in Delphi XE?

Tpanel does not show the top and left border under Delphi XE/Win 7.
Why?
Example (I just dropped few TPanel from pallete to my form, inside of a TTabSheet):
How do I make it look like the original Delphi 7 control (with all 4 borders), without changeing its properties every time I place it on my form?
Set ParentBackground to false.
Above is a blue panel on a green form (ParentBackground = false). Notice the white upper-left border and the gray bottom-right border. Of course, if both the form and the panel are white, the white border will become invisible.
That is how it meant to be drawn. The 3D effect is as if there was a light source shining from the top left. That's why the bottom and right edges are in a shadow cast by the raised panel.
Regarding your updated question, it sounds like you want your application to run without themes. The easiest way is to uncheck "Enable runtime themes" in the Application pane of the project settings.
But of course that would look odd nowadays. If you are using the panel to group related controls, perhaps a group box would be better. My instincts are that panels with raised borders will look poor on modern themed Windows.

How to add background images to Delphi forms

How can I add a background image to my delphi form? I added a TImage, but now the labels aren't visible any more, and the texts of my checkboxes are in a blue "box" (blue is the background color i chose). This blue doesn't look very good on the background image, and the hidden labels also don't look good. How do I fix these problems?
For the labels: make sure that they are transparent (Transparent property in the Object Inspector), and that they are on top of the TImage in the Z-order of controls. To correct this you can execute the "Send to back" command on the TImage component in design mode, it will make all other non-windowed controls appear on top of it.
For the checkboxes I don't know what the problem in your case is, in Delphi 2007 checkboxes appear properly transparent when put over a TImage. Maybe you use an earlier Delphi version? If so it would be good to mention this in the question. There may also be a different behaviour depending on whether themes are active. Again, hard to say without further information.
Move the TImage to the back of the form (right click, order -> send to back).
For labels, set the Transparent property to true. For checkboxes and radio buttons, at least in Delphi 6 which is all I have access to, there is no transparent property. The way round this is to reduce the controls label to zero size and the provide your own additional TLabel, which can be transparent.
Can I also say that I find windows with background images ultra naff, and I know I'm not alone in this.

Resources