fork download
  1. ' System.Design.dll の参照が必要
  2.  
  3. Option Infer On
  4.  
  5. Imports System.ComponentModel.Design
  6. Imports System.ComponentModel.Design.Serialization
  7.  
  8. Public Class Form1
  9. Inherits System.Windows.Forms.Form
  10.  
  11. Private WithEvents Button1 As Button
  12. Private WithEvents FlowLayoutPanel1 As FlowLayoutPanel
  13. Private WithEvents TextBox1 As TextBox
  14. Private WithEvents PropertyGrid1 As PropertyGrid
  15.  
  16. Public Sub New()
  17. Me.InitializeComponent()
  18. End Sub
  19.  
  20. Private Sub InitializeComponent()
  21. Me.Button1 = New System.Windows.Forms.Button()
  22. Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel()
  23. Me.TextBox1 = New System.Windows.Forms.TextBox()
  24. Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid()
  25. Me.SuspendLayout()
  26. '
  27. 'Button1
  28. '
  29. Me.Button1.Location = New System.Drawing.Point(5, 348)
  30. Me.Button1.Name = "Button1"
  31. Me.Button1.Size = New System.Drawing.Size(75, 23)
  32. Me.Button1.TabIndex = 1
  33. Me.Button1.Text = "Button1"
  34. Me.Button1.UseVisualStyleBackColor = True
  35. '
  36. 'FlowLayoutPanel1
  37. '
  38. Me.FlowLayoutPanel1.Location = New System.Drawing.Point(5, 62)
  39. Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1"
  40. Me.FlowLayoutPanel1.Size = New System.Drawing.Size(116, 280)
  41. Me.FlowLayoutPanel1.TabIndex = 2
  42. '
  43. 'TextBox1
  44. '
  45. Me.TextBox1.Location = New System.Drawing.Point(5, 14)
  46. Me.TextBox1.Name = "TextBox1"
  47. Me.TextBox1.Size = New System.Drawing.Size(100, 19)
  48. Me.TextBox1.TabIndex = 3
  49. '
  50. 'PropertyGrid1
  51. '
  52. Me.PropertyGrid1.Location = New System.Drawing.Point(127, 14)
  53. Me.PropertyGrid1.Name = "PropertyGrid1"
  54. Me.PropertyGrid1.SelectedObject = Me.TextBox1
  55. Me.PropertyGrid1.Size = New System.Drawing.Size(287, 328)
  56. Me.PropertyGrid1.TabIndex = 4
  57. '
  58. 'Form1
  59. '
  60. Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
  61. Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
  62. Me.ClientSize = New System.Drawing.Size(427, 383)
  63. Me.Controls.Add(Me.PropertyGrid1)
  64. Me.Controls.Add(Me.TextBox1)
  65. Me.Controls.Add(Me.FlowLayoutPanel1)
  66. Me.Controls.Add(Me.Button1)
  67. Me.Name = "Form1"
  68. Me.Text = "Form1"
  69. Me.ResumeLayout(False)
  70. Me.PerformLayout()
  71.  
  72. End Sub
  73.  
  74. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  75.  
  76. Dim container As New ServiceContainer()
  77. Dim manager As New DesignerserializationManager(container)
  78. Dim service As New CodeDomComponentSerializationService(manager)
  79. Dim store = service.CreateStore()
  80.  
  81. service.Serialize(store, Me.TextBox1)
  82. store.Close()
  83.  
  84. Dim collection = service.Deserialize(store)
  85. Dim textBox2 = DirectCast(collection(0), TextBox)
  86. Me.FlowLayoutPanel1.Controls.Add(textBox2)
  87.  
  88. End Sub
  89.  
  90. End Class
  91.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.8 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.

/home/IIGSsv/prog.vb (11,41) : error VBNC30451: 'Button' is not declared. It may be inaccessible due to its protection level.
There were 1 errors and 0 warnings.
Compilation took 00:00:00.3289090
stdout
Standard output is empty