// 手抜きでシェイプそのものをバインド。実際はラッパークラスを設けた方が良い this.listBox1.DataSource = this.bindingSource1; this.bindingSource1.DataSource = worksheet.FloatingObjects; private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { // 編集画面を作りこむのが面倒なので、PropertyGrid に渡すだけの手抜き処理 this.propertyGrid1.SelectedObject = listBox1.SelectedItem; } private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { // シェイプが変更通知イベントを有していないので、手動で再描画を依頼する this.reoGridControl1.Invalidate(); }
Private Sub Command1_Click() Dim wb As Object Set wb = Me.OLE1.object Dim shp As Object Set shp = wb.Worksheets("Sheet1").Shapes.AddShape(1, 20, 10, 60, 40) shp.Fill.Visible = False shp.Line.ForeColor.RGB = RGB(255, 0, 0) End Sub