# How can I style a cell frame with rounded corners?

I'd like use rounded rectangles for my cell style, but I'm not sure if this is possible. Perhaps it can be faked with an image as a background for it?

-
Framed has the option RoundingRadius. This is not for cell frames though, but it may lead the way to a solution. –  Szabolcs Mar 1 '13 at 18:42

You might work around the limitations of CellFrame by framing the content. Framed allows for a RoundingRadius.

CellPrint[
Framed[TextCell[
StringTake[
ExampleData[{"Text", "AliceInWonderland"}], {200, 1000}], "Text",
CellMargins -> {{100, 50}, {5, 5}}], RoundingRadius -> 15,
FrameStyle -> Red]]


-
Sorry, Szabolcs. I only noticed your comment after answering the question. Really. –  David Carraher Mar 1 '13 at 23:44
You notice the artefacts this yields in the text? –  Sjoerd C. de Vries Mar 1 '13 at 23:49
Thanks. Placing Framed around the TextCell seems to take care of it. –  David Carraher Mar 2 '13 at 0:00
Much better. Though not really a cell frame as asked by the OP, I think this is the closest to what it would look like. –  Sjoerd C. de Vries Mar 2 '13 at 8:56
Yes but this won't work in a style sheet :/ –  M.R. Mar 4 '13 at 9:08

I don't think this is possible. One can set the four sides of the cell frame to various different styles using the undocumented option CellFrameStyle which you have to prefix with the System context to get it to work (syntax coloring won't recognize it as a valid option):

CellPrint[
TextCell[
StringTake[ExampleData[{"Text", "AliceInWonderland"}], {200, 1000}],
"Text",
CellFrame -> True,
SystemCellFrameStyle ->
{ Directive[Red, Thickness[5] ],
Directive[Green, Thickness[10], Dashed ],
Directive[Blue, Thickness[5] , Dotted],
Directive[Gray, Thickness[5] , Dashing[{20, 3}]]
},
CellMargins -> {{100, 50}, {5, 5}}]]


.

The fact that you can specify it as four separate frame parts make me believe rounded corners are not possible. With sides specified separately I don't think an option like RoundingRadius would work.

-
On my system (v9 Linux), the System context is not required, and Dashed and Dotted do not seem to work the same as your example (but Dashing does). CapForm or JoinForm might be useful for producing rounding but also do not work. –  Xerxes Mar 1 '13 at 23:45
@xerxes interesting. On Windows, using it without context, doesn't do anything. Upon inspection of the cell code (ctrl shift E) I see an extra \$CellContext tagged to CellFrameStyle. Tagging it with System prevents this. –  Sjoerd C. de Vries Mar 2 '13 at 9:00