public void DisplayBubble() { Recordset recordset = null; if (m_sceneControl.Bubbles.Count > 0) { m_sceneControl.Bubbles.Clear(); } if (m_selection != null) { m_selection.Clear(); } Bubble bubble = null; (m_sceneControl.Scene.Layers["理工@底图"] as Layer3DDataset).Selection.Add(16); m_selection = m_sceneControl.Scene.FindSelection(true)[0]; recordset = m_selection.ToRecordset(); bubble = new Bubble(); m_sceneControl.Bubbles.Add(bubble); FillBubbleControlModel(recordset); bubble.ClientWidth = m_bubbleControlModel.Width; bubble.ClientHeight = m_bubbleControlModel.Height; m_flag = true; Geometry3D geometry3D = recordset.GetGeometry() as Geometry3D; Point3D point3D = geometry3D.BoundingBox.Center; bubble.Pointer = point3D; } //填充模型气泡上的信息 private void FillBubbleControlModel(Recordset recordset) { // 获取选中模型对象所在的记录集中Name字段值,并赋值给特殊气泡控件的SelectModelName属性 m_bubbleControlModel.ModelName.Text = recordset.GetFieldValue("ModelName").ToString(); }
我用了这段代码添加气泡,请问
(m_sceneControl.Scene.Layers["理工@底图"] as Layer3DDataset).Selection.Add(16); 这段代码双括号内加的是面要素的图层,还是场景呢,示例代码内加的是模型图层。运行这段代码后会跳出未将对象引用添加到对象实例。如果将这三行代码注释掉。就只出现一个气泡。另外,气泡上是空白。就是这个样子。我觉得可能是双引号内加的内容的问题,你觉得呢,
求问求问
您看一下这个,加深理解
我感觉我选的没什么问题。。。。。解决不了了