1
我擺弄的代碼是:試圖找出如何引爆的事件時按下Enter鍵在TextBox按下
open System
open System.Windows.Forms
open System.Drawing
let tehform = new Form(Text = "STOP!", Width = 200, Height = 200)
let awe = new TextBox(Left = 1, Top = 30, Width = 100)
let stuff _ _ = MessageBox.Show(awe.Text) |> ignore
let handler = new EventHandler(stuff)
let yeah = new Button(Text = "", Left = 20, Top = 60, Width = 80)
yeah.Click.AddHandler(handler)
let ms = new MenuStrip()
let file = new ToolStripDropDownButton("File")
let ddi = file.DropDownItems.Add("Hi")
ddi.Click.AddHandler(handler) |> ignore
ms.Items.Add(file) |> ignore
let dc c = (c :> Control)
tehform.Controls.AddRange([| dc yeah; dc ms; dc awe |])
我想,看在圖書館,我可以用awe.OnEnter.AddHandler(處理程序),但也沒有工作。謝謝您的幫助!
你知道你玩的時候太多暈... 你打電話給你的表格「tehForm」。 – jcollum 2008-12-18 19:37:18