require 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' require 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' # Initialization Constants Window = System::Windows::Window Application = System::Windows::Application Button = System::Windows::Controls::Button StackPanel = System::Windows::Controls::StackPanel MessageBox = System::Windows::Forms::MessageBox # Create window my_window = Window.new my_window.width = 200 my_window.height = 150 my_window.title = 'ButtonTest' # Create StackPanel my_stack = StackPanel.new my_window.content = my_stack button1 = Button.new button1.content = 'Button 1' button1.font_size = 20 button1.click do |sender, args| MessageBox.show 'Button 1' end button2 = Button.new button2.content = 'Button 2' button2.font_size = 20 button2.click do |sender, args| MessageBox.show 'Button 2' end my_stack.children.add button1 my_stack.children.add button2 # Run application my_app = Application.new my_app.run my_window