none
在classA的click方法调用classB的ListiView有bug,内详 RRS feed

  • 问题

  • public partial class Map :DSkinUserControl
    {

        private void MainMap_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                isLeftButtonDown = false;
                if (checkBoxDrawPolygon.Checked)
                {
                     if(polyOverlay.Polygons.Count >0)
                     {
                            GMapPolygon polygon = polyOverlay.Polygons[0];
                            List<GMapMarker> selectedMarker = new List<GMapMarker>();
                            foreach(GMapMarker gm in markerOverlay.Markers)
                            {
                                if (polygon.IsInside(gm.Position))
                                    selectedMarker.Add(gm);
                       }
                       selectedMarkerList.Items.Clear();
                       selectedMarkerList.Visible = true;
                       button1.Text = "-";
                       foreach(GMapMarker gm in selectedMarker)
                       {
                              selectedMarkerList.Items.Add(gm.ToolTipText);
                        }
                    }
                        polyOverlay.Polygons.Clear();
                }
            }
        }

    }

    public partial class FrmMain : DSkinForm
    {

        public void MemberTree_DoubleClick(object sender,EventArgs e)
        {
            DSkin.Controls.DSkinTreeView tv = sender as DSkin.Controls.DSkinTreeView;
            if (tv.SelectedNode == null) return;
            MsNode n = tv.SelectedNode as MsNode;
            Map m = new Map();
            if (m.selectedMarkerList.Visible == false)
            {
                m.selectedMarkerList.Visible = true;
                m.button1.Text = "-";
            }
            if (!m.selectedMarkerList.Items.ContainsKey(n.Text))
            {
                m.selectedMarkerList.Items.Add(n.Text);
            }
        }

    }

    在class Map可以通过button控制selectedMarkerList的visible且在UI有变化,在FrmMain虽然能改visible但在UI没变化,Add的text也没在UI显示,调试没报错没异常,这大概是什么问题?谢谢。

    2018年1月15日 1:53

全部回复

  • Hi,

    欢迎在MSDN论坛发帖。

    从代码中看不出什么问题,你能提供一份可以重现问题的代码到one drive 上面吗? 这样方便我们测试。(请不要保护私人信息在其中)

    如果你在两个类中调用另外一个类的方法,请确保你使用的是一个实例。

    Best  Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年1月15日 8:18
  • Hi,

    欢迎在MSDN论坛发帖。

    从代码中看不出什么问题,你能提供一份可以重现问题的代码到OneDrive上面吗? 这样方便我们测试。(请不要保护私人信息在其中)

    如果你在两个类中调用另外一个类的方法,请确保你使用的是一个实例。

    Best  Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    很遗憾,项目使用收费工具库Dskin开发,即使提供源码也无用,无授权者无法调试。

    selectMarkerList是一个可视控件,并非method。


    2018年1月15日 8:44
  • Hi,

    这个涉及到三方产品的开发,根据MSDN论坛的规则,你可以去找三方产品公司,询问支持。我将把帖子移到一般性讨论问题论坛

    Best  Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年1月16日 7:41
  • Thx。实际上Dskin库并不影响后台功能实现,它只管UI。
    2018年1月18日 1:11
  • Hi,

    这个涉及到三方产品的开发,根据MSDN论坛的规则,你可以去找三方产品公司,询问支持。我将把帖子移到一般性讨论问题论坛

    Best  Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    请版主关闭本贴吧,谢谢 。
    2018年1月29日 8:25