標籤:
發現SharpDevelop 也支援Ruby ,特別是可以直接把winform的控制項直接用在
require "mscorlib"require "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"require "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"class MainForm < System::Windows::Forms::Formdef initialize()self.InitializeComponent()enddef InitializeComponent()@button1 = System::Windows::Forms::Button.new()self.SuspendLayout()# # button1# @button1.Location = System::Drawing::Point.new(85, 45)@button1.Name = "button1"@button1.Size = System::Drawing::Size.new(75, 23)@button1.TabIndex = 0@button1.Text = "button1"@button1.UseVisualStyleBackColor = true@button1.Click { |sender, e| self.Button1Click(sender, e) }# # MainForm# self.ClientSize = System::Drawing::Size.new(292, 266)self.Controls.Add(@button1)self.Name = "MainForm"self.Text = "mm"self.ResumeLayout(false)enddef Button1Click(sender, e) System::Windows::Forms::MessageBox.Show("hello world")endend
Ruby-調用windows表單