码迷,mamicode.com
首页 > Windows程序 > 详细

Ruby-调用windows窗体

时间:2015-04-22 10:57:53      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

发现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::Form
	def initialize()
		self.InitializeComponent()
	end

	def 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)
	end

	def Button1Click(sender, e)
		 System::Windows::Forms::MessageBox.Show("hello world")
	end
end

Ruby-调用windows窗体

标签:

原文地址:http://www.cnblogs.com/yangleiWPF/p/4446480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!