如何控制机器人输入字段中的字体外观?

时间:2011-12-21 04:04:40

标签: wolfram-mathematica

抱歉我可以在这里制作一些可能微不足道的东西,但我刚才意识到我不知道如何在Manipulator控件的输入字段中设置字体样式。此功能的所有选项都不适用于输入字段(AFAIK)中的样式。我想知道输入字段选项是否有效:

Style[Manipulator[0.5, Appearance -> {"Open", Tiny}], 
 DefaultOptions -> {InputField -> {BaseStyle -> Directive[Red, 16]}}]

Mathematica graphics

但事实并非如此。我认为这是微不足道的,但它让我感到难过。

修改

我尝试使用本地机械手样式

Cell[StyleData["Manipulator"],
 ShowStringCharacters->False,
 NumberMarks->False,
 FontFamily:>CurrentValue["PanelFontFamily"],
 FontSize->24,
 FontColor->RGBColor[1,0,0],
 FontWeight->"Bold"]

Mathematica graphics

这改变了字体颜色和重量(我不希望在我的应用程序中更改这些,只测试哪些有效,哪些无效)但仍然没有改变字体大小。如果这个样式表解决方案有效,我想现在已经足够了,但最终我希望在Manipulate中有一个微小的操纵器:

{{x, 40, "Hello World"}, 20, 100, 5, Appearance -> "Open", 
AppearanceElements -> {"InputField", "StepLeftButton", "StepRightButton",    
                        "HideControlsButton"}, ImageSize -> Tiny}

但在输入字段中使用非小字体,并通过直接编码实现此目的。

1 个答案:

答案 0 :(得分:3)

我知道改变字段中文本大小的唯一方法是用Magnification命中整个事物。使用上面的Simon指导,使用Style

执行此操作
Style[
  Manipulator[0.5, Appearance -> {"Open", Tiny}], 
  DynamicBoxOptions -> {BaseStyle -> Magnification -> 2}
]

Mathematica graphics