【问题标题】:pass a control name as a variable and then hide a control using that variable将控件名称作为变量传递,然后使用该变量隐藏控件
【发布时间】:2023-01-09 00:40:20
【问题描述】:

我正在构建一个函数,它将接收(在本例中)FlowLayoutPanel 的名称作为变量 showme,我想使用此变量来设置该特定面板可见。

ps 我是 c++ 的新手!

任何帮助将不胜感激。

以下不工作

   void JommSwitchPanels(FlowLayoutPanel^ showme)
   {
       
       //stuff here to hide the menu panels
       
        showme.Visable = true;//the error is shown on showme
               
       flowfleet1->Visible = false;            
       flowhr->Visible = false;
   }

【问题讨论】:

    标签: c++-cli


    【解决方案1】:

    showmeFlowLayoutPanel 对象的句柄。
    在 c++/cli 中取消引用 handle to object 是使用箭头运算符 (->) 完成的。
    您在属性名称 (Visable/Visible) 中也有错字。

    因此你需要改变:

    showme.Visable = true;
    

    到:

    //----vv--------------
    showme->Visible = true;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      相关资源
      最近更新 更多