首页 / 浏览问题 / 组件GIS / 问题详情
Bubble 没有标题和关闭按钮
48EXP 2019年06月25日

操作系统:win10 x64
数据类型:  文件型
问题详细描述:弹出的bubble 没有标题和关闭按钮(图一所示),并且界面显示不完整。

  private void AddBubble()
        {
            Recordset recordset = null;
            try
            {
                if (m_curSceneControl.Bubbles.Count > 0)
                {
                    m_curSceneControl.Bubbles.Clear();
                }
                Bubble bubble = null;
                m_selection = m_curSceneControl.Scene.FindSelection(true)[0];
                recordset = m_selection.ToRecordset();
                bubble = new Bubble();
                m_curSceneControl.Bubbles.Add(bubble);

                FillBubbleControlModel(recordset);

                bubble.ClientWidth = m_bubbleControlModel.Width;
                bubble.ClientHeight = m_bubbleControlModel.Height;

                Geometry3D geometry3D = recordset.GetGeometry() as Geometry3D;
                Point3D point3D = geometry3D.BoundingBox.Upper;
                bubble.Pointer = point3D;
                bubble.Title = "test";
                bubble.RoundQuality = 1;
                bubble.IsAutoHide = false;               
                bubble.FrameWidth = 20;
                bubble.BackColor = Color.FromArgb(100, 185, 230, 253);
                TextStyle textStyle = new TextStyle();
                textStyle.Alignment = SuperMap.Data.TextAlignment.TopCenter;
                textStyle.FontName = "黑体";

                textStyle.ForeColor = Color.Black;
                bubble.TitleTextStyle = textStyle;
                bubble.Visible = true;
                m_curSceneControl.Scene.Refresh();
                
            }
            catch (System.Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            finally
            {
                if (recordset != null)
                {
                    recordset.Close();
                    recordset.Dispose();
                }
            }
        }
 private void CurSceneControl_BubbleInitialize(object sender, BubbleEventArgs e)
        {
            System.Drawing.Point point = new Point(e.Bubble.ClientLeft, e.Bubble.ClientTop);
            if (m_selection != null)
            {
                m_bubbleControlModel.Location = point;                
                m_bubbleControlModel.Visible = true;
            }
        }

        private void CurSceneControl_BubbleClose(object sender, BubbleEventArgs e)
        {
            m_bubbleControlModel.Visible = false;           
        }

        private void CurSceneControl_BubbleResize(object sender, BubbleEventArgs e)
        {                   
            System.Drawing.Point point = new Point(e.Bubble.ClientLeft, e.Bubble.ClientTop);
            if (m_selection != null)
            {
                m_bubbleControlModel.Location = point;
                m_bubbleControlModel.Visible = true;
            }
        }

1个回答

您好!bubble.ClientWidth = m_bubbleControlModel.Width;
                bubble.ClientHeight = m_bubbleControlModel.Height;
这两行代码来决定bubble的绘图区宽度和高度,界面显示不完整请设置m_bubbleControlModel对应的控件的宽度和高度。

您的标题和关闭按钮消失应该是将自定义控件的外观设置了BorderStyle指定面板不显示边框。
3,352EXP 2019年06月25日
您好,我又检查了一下,发现BorderStyle没有修改,是None。这个和wpf有关系吗?
您好!您的自定义控件是用wpf做的吗?咱们iobjects.net范例里有气泡范例:安装目录\SampleCode\Realspace\Bubble\Bubble.csproj,您可以参照这个上面来制作自定义控件。
...