Canvas/Pad border color

Hello,

I was searching for the solution to change the pad(canvas) border color.
The only one I was able to find is as follows (suggested by Brun)

TBox b(gPad->GetX1(),gPad->GetY1(),gPad->GetX2(),gPad->GetY2());
b.SetFillStyle(0);
b.SetLineWidth(6);
b.Draw();

That was in 2002.
I’m wondering is there a better way to set up the border color today? :unamused:

Thank you!

[quote=“netspirit”]. . .I’m wondering is there a better way to set up the border color today? :unamused: [/quote]What do you mean better? What is wrong with the Rene’s method? It does what you want.

On the other hands, as far as I know you use the Qt-layer anyway.
This means, you can put the TQtWidget (embedded TCanvas) object into QFrame ( doc.trolltech.com/4.4/qwidget.ht … Sheet-prop
to customize doc.trolltech.com/4.4/stylesheet … ing-qframe
For example, the simple addition:QFrame *frame = new QFrame(); TQtWidget *canvas = new TQtWidget(frame); frame->setStyleSheet("QFrame{border: 6px solid green; border-radius: 12px; padding: 2px;}");to the notorious HelloCanvas example will change its appearance. (see attachment)
However, it seems this is quite expansive approach to do such simple thing like the coloring the TCanvas border.

You can also do something like

canvas.SetBorderSize(6); canvas.SetHighLightColor(kBlue); //or whatever color

Rene