0
$\begingroup$

I want to make a Grid with each cell Imagesize was {10,10}.If I place any Gui-Element with more than that cell Imagesize,I don't want to scale that cell.

I want to set each cell ImageSize is {10,10}.

For this purpose,I tried with both Grid and GraphicsGrid.

If you can use Grpahicsrid,it's working fine.That corresponding code is in below.

GraphicsGrid[ConstantArray["234", {3, 4}], Frame -> All,ImageSize -> {40, 30}]

If you use Grid,it's not working.That corresponding code is in below.

 Grid[ConstantArray["234", {3, 4}], Frame -> All, ItemSize -> {10, 10}]

I think,Itemsize units totally different compared with ImageSize.That's why it's not working .

How can I resolve this ?

$\endgroup$

1 Answer 1

3
$\begingroup$

There is a known-difficult problem in this:
How to convert between various ItemSize/ImageSize units?

Nevertheless:

ItemSize:

In Grid, w is measured in ems, and h in line heights. In GraphicsGrid, w and h are both measured in absolute printer's points.

Pane:

Pane[expr,{w,h}] makes the pane be w points wide, and h points high, shrinking the contents if necessary.

So we can get close with this:

Grid[ConstantArray[Pane["234", {20, 20}], {3, 4}], Frame -> All, Spacings -> {0, 0}]

enter image description here

There is however distortion as the cell sizes become very small:

enter image description here

I do not know a way around this other than manually adjusting a small negative spacing based on the pane size.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.