2010年10月30日土曜日

ruby1.8.7 + gtk2-0.90.5 demo button Boxes


ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]

C:\Documents and Settings\takashi>cd C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>ruby -rubygems main.rb


ruby1.9.2 + gtk2-0.90.5 gtk_demo:main.rb no such file to load

ruby1.9.2に gtk2-0.90.5を入れたのですがgtk_demo:main.rbでWidget(double click for demo)を
の項目をdouble clickするとin `require': no such file to load -- となります。

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\Documents and Settings\takashi>gem install gtk2
Temporarily enhancing PATH to include DevKit...
Successfully installed pkg-config-1.0.7
Successfully installed cairo-1.10.0-x86-mingw32
Successfully installed glib2-0.90.2-x86-mingw32
Successfully installed pango-0.90.2-x86-mingw32
Successfully installed atk-0.90.2-x86-mingw32
Successfully installed gtk2-0.90.2-x86-mingw32
6 gems installed
Installing ri documentation for pkg-config-1.0.7...
Installing ri documentation for cairo-1.10.0-x86-mingw32...

RDoc::Parser::Ruby failure around line 131 of
lib/cairo.rb

Before reporting this, could you check that the file you're documenting
compiles cleanly--RDoc is not a full Ruby parser, and gets confused easily if
fed invalid programs.

The internal error was:

(RDoc::Error) Name or symbol expected (got #)

ERROR: While generating documentation for cairo-1.10.0-x86-mingw32
... MESSAGE: Name or symbol expected (got #)
... RDOC args: lib
(continuing with the rest of the installation)
Installing ri documentation for glib2-0.90.2-x86-mingw32...
Installing ri documentation for pango-0.90.2-x86-mingw32...
Installing ri documentation for atk-0.90.2-x86-mingw32...
Installing ri documentation for gtk2-0.90.2-x86-mingw32...
Installing RDoc documentation for pkg-config-1.0.7...
Installing RDoc documentation for cairo-1.10.0-x86-mingw32...

RDoc::Parser::Ruby failure around line 131 of
lib/cairo.rb

Before reporting this, could you check that the file you're documenting
compiles cleanly--RDoc is not a full Ruby parser, and gets confused easily if
fed invalid programs.

The internal error was:

(RDoc::Error) Name or symbol expected (got #)

ERROR: While generating documentation for cairo-1.10.0-x86-mingw32
... MESSAGE: Name or symbol expected (got #)
... RDOC args: lib
(continuing with the rest of the installation)
Installing RDoc documentation for glib2-0.90.2-x86-mingw32...
Installing RDoc documentation for pango-0.90.2-x86-mingw32...
Installing RDoc documentation for atk-0.90.2-x86-mingw32...
Installing RDoc documentation for gtk2-0.90.2-x86-mingw32...

C:\Documents and Settings\takashi>cd C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>ruby main.rb
:29:in `require': no such file to load -- gdk_pixbuf2 (LoadError)
from :29:in `require'
from C:/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2/base.rb:27:in `'
from :29:in `require'
from :29:in `require'
from C:/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2.rb:11:in `'
from :33:in `require'
from :33:in `rescue in require'
from :29:in `require'
from main.rb:11:in `
'

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>gem install gdk_pixbuf2
Temporarily enhancing PATH to include DevKit...
Successfully installed glib2-0.90.5-x86-mingw32
Successfully installed gdk_pixbuf2-0.90.5-x86-mingw32
2 gems installed
Installing ri documentation for glib2-0.90.5-x86-mingw32...
Installing ri documentation for gdk_pixbuf2-0.90.5-x86-mingw32...
Installing RDoc documentation for glib2-0.90.5-x86-mingw32...
Installing RDoc documentation for gdk_pixbuf2-0.90.5-x86-mingw32...

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>ruby main.rb
C:/ruby/Ruby192/lib/ruby/1.9.1/rubygems.rb:238:in `activate': can't activate glib2 (>= 0.90.5, runtime) for ["gdk_pixbuf2-0.90.5
-x86-mingw32"], already activated glib2-0.90.2-x86-mingw32 for ["gtk2-0.90.2-x86-mingw32"] (Gem::LoadError)
from C:/ruby/Ruby192/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
from C:/ruby/Ruby192/lib/ruby/1.9.1/rubygems.rb:253:in `each'
from C:/ruby/Ruby192/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
from C:/ruby/Ruby192/lib/ruby/1.9.1/rubygems.rb:1119:in `try_activate'
from :32:in `rescue in require'
from :29:in `require'
from C:/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2/base.rb:27:in `'
from :29:in `require'
from :29:in `require'
from C:/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2.rb:11:in `'
from :33:in `require'
from :33:in `rescue in require'
from :29:in `require'
from main.rb:11:in `
'

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>gem update
Updating installed gems
Updating atk
Temporarily enhancing PATH to include DevKit...
Successfully installed atk-0.90.5-x86-mingw32
Updating gtk2
Successfully installed pango-0.90.5-x86-mingw32
Successfully installed gtk2-0.90.5-x86-mingw32
Updating minitest
Successfully installed minitest-1.7.2
Updating rdoc
RDoc 2.5 did not save method parameters, so you should upgrade your rdoc-data
gem to a version >= 2.5.3.

To have ri data for core and stdlib you'll need to:

gem install rdoc-data

then run:

rdoc-data --install

To have ri data for you gems you'll also need to run:

gem rdoc --all --overwrite

If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
Successfully installed rdoc-2.5.11
Gems updated: atk, pango, gtk2, minitest, rdoc
Installing ri documentation for atk-0.90.5-x86-mingw32...
Installing ri documentation for pango-0.90.5-x86-mingw32...
Installing ri documentation for gtk2-0.90.5-x86-mingw32...
Installing ri documentation for minitest-1.7.2...
Installing ri documentation for rdoc-2.5.11...
Installing RDoc documentation for atk-0.90.5-x86-mingw32...
Installing RDoc documentation for pango-0.90.5-x86-mingw32...
Installing RDoc documentation for gtk2-0.90.5-x86-mingw32...
Installing RDoc documentation for minitest-1.7.2...
Installing RDoc documentation for rdoc-2.5.11...

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>cd C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk
2-0.90.5-x86-mingw32\sample\gtk-demo

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>ruby main.rb
:29:in `require': no such file to load -- changedisplay.rb
from :29:in `require'
from main.rb:212:in `row_activated_cb'
from main.rb:182:in `block in create_tree'
from main.rb:380:in `call'
from main.rb:380:in `main'
from main.rb:380:in `
'

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>ruby main.rb
:29:in `require': no such file to load -- clipboard.rb
from :29:in `require'
from main.rb:212:in `row_activated_cb'
from main.rb:182:in `block in create_tree'
from main.rb:380:in `call'
from main.rb:380:in `main'
from main.rb:380:in `
'

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>ruby main.rb
:29:in `require': no such file to load -- button_box.rb
from :29:in `require'
from main.rb:212:in `row_activated_cb'
from main.rb:182:in `block in create_tree'
from main.rb:380:in `call'
from main.rb:380:in `main'
from main.rb:380:in `
'

C:\ruby\Ruby192\lib\ruby\gems\1.9.1\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>

ruby1.8.7 + gtk2-0.90.5

gtk2を入れなおした。gtk2-0.90.5で.4でのエラーが取れている。

ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]

C:\Documents and Settings\takashi>gem update
Updating installed gems
Nothing to update

C:\Documents and Settings\takashi>gem list

*** LOCAL GEMS ***

qtbindings (4.6.3.1 x86-mingw32)

C:\Documents and Settings\takashi>gem install gtk2
Temporarily enhancing PATH to include DevKit...
Successfully installed pkg-config-1.0.7
Successfully installed cairo-1.10.0-x86-mingw32
Successfully installed glib2-0.90.2-x86-mingw32
Successfully installed pango-0.90.2-x86-mingw32
Successfully installed atk-0.90.2-x86-mingw32
Successfully installed gtk2-0.90.2-x86-mingw32
6 gems installed
Installing ri documentation for pkg-config-1.0.7...
Installing ri documentation for cairo-1.10.0-x86-mingw32...
Installing ri documentation for glib2-0.90.2-x86-mingw32...
Installing ri documentation for pango-0.90.2-x86-mingw32...
Installing ri documentation for atk-0.90.2-x86-mingw32...
Installing ri documentation for gtk2-0.90.2-x86-mingw32...
Installing RDoc documentation for pkg-config-1.0.7...
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc
Installing RDoc documentation for cairo-1.10.0-x86-mingw32...
Could not find main page README.txt
Could not find main page README.txt
Could not find main page README.txt
Could not find main page README.txt
Installing RDoc documentation for glib2-0.90.2-x86-mingw32...
Installing RDoc documentation for pango-0.90.2-x86-mingw32...
Installing RDoc documentation for atk-0.90.2-x86-mingw32...
Installing RDoc documentation for gtk2-0.90.2-x86-mingw32...

C:\Documents and Settings\takashi>cd C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>ruby -rubygems main.rb
C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- gdk_pixb
uf2 (LoadError)
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2/base.rb:27
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2.rb:11
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from main.rb:11

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>gem install gdk_pixbuf2
Temporarily enhancing PATH to include DevKit...
Successfully installed glib2-0.90.5-x86-mingw32
Successfully installed gdk_pixbuf2-0.90.5-x86-mingw32
2 gems installed
Installing ri documentation for glib2-0.90.5-x86-mingw32...
Installing ri documentation for gdk_pixbuf2-0.90.5-x86-mingw32...
Installing RDoc documentation for glib2-0.90.5-x86-mingw32...
Installing RDoc documentation for gdk_pixbuf2-0.90.5-x86-mingw32...

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>gem list

*** LOCAL GEMS ***

atk (0.90.2 x86-mingw32)
cairo (1.10.0 x86-mingw32)
gdk_pixbuf2 (0.90.5 x86-mingw32)
glib2 (0.90.5 x86-mingw32, 0.90.2 x86-mingw32)
gtk2 (0.90.2 x86-mingw32)
pango (0.90.2 x86-mingw32)
pkg-config (1.0.7)
qtbindings (4.6.3.1 x86-mingw32)

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>ruby -rubygems main.rb
C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate glib2 (>= 0.90.5, runtime) for ["gdk_pixbuf
2-0.90.5-x86-mingw32"], already activated glib2-0.90.2-x86-mingw32 for ["gtk2-0.90.2-x86-mingw32"] (Gem::LoadError)
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2/base.rb:27
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/gtk2-0.90.2-x86-mingw32/lib/gtk2.rb:11
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from main.rb:11

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.2-x86-mingw32\sample\gtk-demo>gem update
Updating installed gems
Updating atk
Temporarily enhancing PATH to include DevKit...
Successfully installed atk-0.90.5-x86-mingw32
Updating gtk2
Successfully installed pango-0.90.5-x86-mingw32
Successfully installed gtk2-0.90.5-x86-mingw32
Gems updated: atk, pango, gtk2
Installing ri documentation for atk-0.90.5-x86-mingw32...
Installing ri documentation for pango-0.90.5-x86-mingw32...
Installing ri documentation for gtk2-0.90.5-x86-mingw32...
Installing RDoc documentation for atk-0.90.5-x86-mingw32...
Installing RDoc documentation for pango-0.90.5-x86-mingw32...
Installing RDoc documentation for gtk2-0.90.5-x86-mingw32...

C:\>cd C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo

C:\ruby\Ruby187\lib\ruby\gems\1.8\gems\gtk2-0.90.5-x86-mingw32\sample\gtk-demo>ruby -rubygems main.rb

ruby1.9.2 + qtbindings (4.6.3.1 x86-mingw32)


C:\rubyapi\Qt4>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\rubyapi\Qt4>gem list

*** LOCAL GEMS ***

minitest (1.6.0)
qtbindings (4.6.3.1 x86-mingw32)
rake (0.8.7)
rdiscount (1.6.5)
rdoc (2.5.8)
tk-win (0.2.2 x86-mingw32)

C:\rubyapi\Qt4>ruby gui_qtruby_spl1_sjis.rb

C:\rubyapi\Qt4>ruby gui_qtruby_spl1_utf8.rb

#####gui_qtruby_spl1_utf8.rb
#!ruby -Ku
# -*- coding:utf-8 -*-
require 'Qt4'

app = Qt::Application.new(ARGV)

#hello = Qt::PushButton.new('Hello World!')
hello = Qt::Label.new('こんにちは、世界!')
hello.window_title = 'Hello World! QtRuby utf-8'
hello.resize(260, 60)
hello.show()

app.exec()

####gui_qtruby_spl1_sjis.rb
#!ruby -Ks
# -*- coding:shift_jis -*-
require 'Qt4'

app = Qt::Application.new(ARGV)

#hello = Qt::PushButton.new('Hello World!')
hello = Qt::Label.new('こんにちは、世界!')
hello.window_title = 'Hello World! QtRuby shift_jis'
hello.resize(260, 60)
hello.show()

app.exec()

ruby1.9.2 + qtbindings
shift_jisは漢字表示できるのにutf-8 文字化けします。

ruby1.8.7 + qtbindings
shift_jisはSegmentation fault、utf-8 漢字表示できます。
C:\rubyapi\Qt4>ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]

C:\rubyapi\Qt4>ruby -rubygems gui_qtruby_spl1_sjis.rb
C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/qtbindings-4.6.3.1-x86-mingw32/lib/Qt/qtruby4.rb:2640: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\rubyapi\Qt4>ruby -rubygems gui_qtruby_spl1_utf8.rb

C:\rubyapi\Qt4>


2010年10月23日土曜日

ironruby 1.1.1 release

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\takashi>ir -v
IronRuby 1.1.1.0 on .NET 4.0.30319.1

C:\Documents and Settings\takashi>ir
IronRuby 1.1.1.0 on .NET 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.

>>> RUBY_VERSION
=> "1.9.2"
>>>

2010年10月20日水曜日

IronRuby Accessのテーブル一覧をDataGridViewで表示する

DataGridViewとTextBoxをFormに配置したあとに
⑤menuStripをToolStripContainerの左上に配置する。
 [ここへ入力]に"Open(&O)"を入力する。
 Openをダブルクリック
 def OpenOToolStripMenuItemClick(sender, e)
 endをコード化する
("開く"と入力するとdef 開くOToolStripMenuItemClick(sender, e)となる)
この後、プロパティ:表示:Text"開く(&O)"を入れる
⑥OpenFileDialogをWindowsフォーム上にドラッグする。
 プロパティ:動作:ReadOnlyCheck[True]
RestoreDirectory[[rue]
プロパティ:動作:Filter["Access File (*.mdb)|*.mdb|すべてのファイル (*.*)|*.*"]を入力する。

⑦ def OpenOToolStripMenuItemClick(sender, e)
  の中を記載する。

MsAccessのmdbは
ir.exe -Ku Program.rbにて実行

#Program.rb
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"
require "MainForm"

Application = System::Windows::Forms::Application

Application.EnableVisualStyles()
form = MainForm.new()
Application.Run(form)

#MainForm.rb
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"
require "System.Data"

class MainForm < System::Windows::Forms::Form
def initialize()
self.InitializeComponent()
end

def InitializeComponent()
@toolStripContainer1 = System::Windows::Forms::ToolStripContainer.new()
@splitContainer1 = System::Windows::Forms::SplitContainer.new()
@dataGridView1 = System::Windows::Forms::DataGridView.new()
@textBox1 = System::Windows::Forms::TextBox.new()
@menuStrip1 = System::Windows::Forms::MenuStrip.new()
@openOToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()
@openFileDialog1 = System::Windows::Forms::OpenFileDialog.new()
@toolStripContainer1.ContentPanel.SuspendLayout()
@toolStripContainer1.TopToolStripPanel.SuspendLayout()
@toolStripContainer1.SuspendLayout()
@splitContainer1.Panel1.SuspendLayout()
@splitContainer1.Panel2.SuspendLayout()
@splitContainer1.SuspendLayout()
@dataGridView1.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()
@menuStrip1.SuspendLayout()
self.SuspendLayout()
#
# toolStripContainer1
#
#
# toolStripContainer1.ContentPanel
#
@toolStripContainer1.ContentPanel.Controls.Add(@splitContainer1)
@toolStripContainer1.ContentPanel.Size = System::Drawing::Size.new(488, 242)
@toolStripContainer1.Dock = System::Windows::Forms::DockStyle.Fill
@toolStripContainer1.Location = System::Drawing::Point.new(0, 0)
@toolStripContainer1.Name = "toolStripContainer1"
@toolStripContainer1.Size = System::Drawing::Size.new(488, 266)
@toolStripContainer1.TabIndex = 0
@toolStripContainer1.Text = "toolStripContainer1"
#
# toolStripContainer1.TopToolStripPanel
#
@toolStripContainer1.TopToolStripPanel.Controls.Add(@menuStrip1)
#
# splitContainer1
#
@splitContainer1.Dock = System::Windows::Forms::DockStyle.Fill
@splitContainer1.Location = System::Drawing::Point.new(0, 0)
@splitContainer1.Name = "splitContainer1"
@splitContainer1.Orientation = System::Windows::Forms::Orientation.Horizontal
#
# splitContainer1.Panel1
#
@splitContainer1.Panel1.Controls.Add(@dataGridView1)
#
# splitContainer1.Panel2
#
@splitContainer1.Panel2.Controls.Add(@textBox1)
@splitContainer1.Size = System::Drawing::Size.new(488, 242)
@splitContainer1.SplitterDistance = 97
@splitContainer1.TabIndex = 0
#
# dataGridView1
#
@dataGridView1.ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode.AutoSize
@dataGridView1.Dock = System::Windows::Forms::DockStyle.Fill
@dataGridView1.Location = System::Drawing::Point.new(0, 0)
@dataGridView1.Name = "dataGridView1"
@dataGridView1.RowTemplate.Height = 21
@dataGridView1.Size = System::Drawing::Size.new(488, 97)
@dataGridView1.TabIndex = 0
#
# textBox1
#
@textBox1.Dock = System::Windows::Forms::DockStyle.Fill
@textBox1.Location = System::Drawing::Point.new(0, 0)
@textBox1.Multiline = true
@textBox1.Name = "textBox1"
@textBox1.ScrollBars = System::Windows::Forms::ScrollBars.Both
@textBox1.Size = System::Drawing::Size.new(488, 141)
@textBox1.TabIndex = 0
#
# menuStrip1
#
@menuStrip1.Dock = System::Windows::Forms::DockStyle.None
@menuStrip1.Items.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(
[@openOToolStripMenuItem]))
@menuStrip1.Location = System::Drawing::Point.new(0, 0)
@menuStrip1.Name = "menuStrip1"
@menuStrip1.Size = System::Drawing::Size.new(488, 24)
@menuStrip1.TabIndex = 0
@menuStrip1.Text = "menuStrip1"
#
# openOToolStripMenuItem
#
@openOToolStripMenuItem.Name = "openOToolStripMenuItem"
@openOToolStripMenuItem.Size = System::Drawing::Size.new(51, 20)
@openOToolStripMenuItem.Text = "開く(&O)"
@openOToolStripMenuItem.Click { |sender, e| self.OpenOToolStripMenuItemClick(sender, e) }
#
# openFileDialog1
#
@openFileDialog1.FileName = "openFileDialog1"
@openFileDialog1.Filter = "Access File (*.mdb)|*.mdb|すべてのファイル (*.*)|*.*"
@openFileDialog1.ReadOnlyChecked = true
@openFileDialog1.RestoreDirectory = true
@openFileDialog1.FileOk { |sender, e| self.OpenFileDialog1FileOk(sender, e) }
#
# MainForm
#
self.ClientSize = System::Drawing::Size.new(488, 266)
self.Controls.Add(@toolStripContainer1)
self.MainMenuStrip = @menuStrip1
self.Name = "MainForm"
self.Text = "rubyma_access"
@toolStripContainer1.ContentPanel.ResumeLayout(false)
@toolStripContainer1.TopToolStripPanel.ResumeLayout(false)
@toolStripContainer1.TopToolStripPanel.PerformLayout()
@toolStripContainer1.ResumeLayout(false)
@toolStripContainer1.PerformLayout()
@splitContainer1.Panel1.ResumeLayout(false)
@splitContainer1.Panel2.ResumeLayout(false)
@splitContainer1.Panel2.PerformLayout()
@splitContainer1.ResumeLayout(false)
@dataGridView1.clr_member(System::ComponentModel::ISupportInitialize, :EndInit).call()
@menuStrip1.ResumeLayout(false)
@menuStrip1.PerformLayout()
self.ResumeLayout(false)
end

def OpenOToolStripMenuItemClick(sender, e)
if @openFileDialog1.ShowDialog() == System::Windows::Forms::DialogResult.OK then
@openFileDialog1.FileNames.each do |filename| #ファイルごとに処理をする
@textBox1.AppendText( System::Environment.NewLine)
@textBox1.AppendText( filename + "\r\n")
begin
#接続文字列の取得
strDBConnection = "Provider=Microsoft.Jet.OLEDB.4.0" + ";Data Source=" + filename + ";User Id=admin" + ";Password="
#DBコネクションの生成
conn = System::Data::OleDb::OleDbConnection.new(strDBConnection)
#接続処理
conn.Open()
# C# schemaTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] {null, null, null, "TABLE"});
schemaTable = conn.GetOleDbSchemaTable(System::Data::OleDb::OleDbSchemaGuid.Tables, System::Array[System::String].new([nil,nil,nil,"TABLE"]))
@dataGridView1.DataSource = schemaTable # dataGridViewに表示
@textBox1.AppendText("テーブル一覧を取得しました" + "\r\n")
conn.Close()
rescue Exception => e
@textBox1.AppendText("Connect Error:" + e.Message + "\r\n")
ensure
end
end
end
end

def OpenFileDialog1FileOk(sender, e)
end
end

IronRuby(Sharpdevelop) DataGridViewコントロール




DataGridViewとTextBoxをFormに配置する。
@IT

特集.NET Framework 2.0のWindowsフォーム新機能(後編)新グリッド・コントロールの豊富な機能と高い表現力を参考にして。

SharpDevelop3.2にて

①ToolStripContainerをWindowsフォーム上に配置する。 

[フォームを四辺にドッキングする](プロパティ:配置:Dock[Fill])

②SplitContainerをToolStripContainerの上に配置する。 

[上下分割の方向]にする(Orentation[Horizontal]) [親コンテナにドッキングする](プロパティ:配置:Dock[Fill])

③DataGridViewをSplitContainerのPanel1の上に配置する。

 [親コンテナにドッキングする](プロパティ:配置:Dock[Fill])

④TextBoxをSplitContainerのPanel2の上に配置する。

 [MultiLine]にチェックを入れる プロパティにて配置:Dockを[Fill]

表示:ScrollBarsを[Both]にする