我有兩個按鈕,以及相關圖片如下:如何在包含圖像和文本的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