1
votes

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):

enter image description here

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?

2
do you have a screenshot to illustrate?David Heffernan
OK, so your actual question is how do I change the background colour of the panel?Andreas Rejbrand
(There is a white top-left border in your pictures above. But since the panel background is also white, it is somewhat difficult to see it.)Andreas Rejbrand
(Or are you actually thinking about the TGroupBox, and not the TPanel?)Andreas Rejbrand
@David - Yes, it is an a TTabSheet.thelight

2 Answers

3
votes

Set ParentBackground to false.

A blue panel on a green form

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.

2
votes

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.