我有两个按钮,以及相关图片如下:如何在包含图像和文本的F#中创建按钮?
let btnFoo = new Button()
let imgBar = new BitmapImage(new System.Uri("images/whatever.png", System.UriKind.RelativeOrAbsolute))
我想按钮的内容包含一些文本,也形象。
我可以做任何的这两件事情就好了,但他们没有得到我的都在同一时间上的按钮文本和图像:
btnFoo.Content <- "Text"
btnFoo.Content <- imgBar
这些都不事情工作:
btnFoo.Content <- "Text " + imgBar // compiler hates this
btnFoo.Content <- "Text ", imgBar // compiler is OK, but result is ugly since the image is rendered as the class text
我也不能设置按钮,以图片的背景:
btnFoo.Background <- imgBar // compiler doesn't like this because Background expects a Media.Brush
任何思想S /想法?谢谢!
非常好,谢谢。 – 2010-12-01 17:56:26