在c#和一些图形问题上,我需要您的帮助:我正在开发一个非常简单的应用程序。有一个称为DeltaPregView的独特表单,一个名为DeltaPregController的表单的控制器,以及一个包含项目Main的类:
主类:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
namespace deltaPreg
{
static class Program
{
[MTAThread]
static void Main()
{
//create the view
DeltaPregView view = new DeltaPregView();
//link the view to the APP
Application.Run(view);
//initialize the controller of the APP
DeltaPregController controller = new DeltaPregController(view);
}
}
}
查看课程:
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace deltaPreg
{
public partial class DeltaPregView : Form
{
public DeltaPregView()
{
InitializeComponent();
}
public void init()
{
prova.Visible = false;
}
}
}
和该视图的控制器:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace deltaPreg
{
class DeltaPregController
{
#region variables
private DeltaPregView view;
#endregion
public DeltaPregController(DeltaPregView view)
{
this.view = view;
//start the reading process
start();
}
private void start()
{
view.init();
}
}
}
我想隐藏名为“ prova”的按钮,但是程序中没有任何变化。我是winforms管理领域的新手,谢谢。
问题是您在中调用init
函数之前先打印表格DeltaPregView
。
解决此问题的一种方法是替换这些行:
//link the view to the APP
Application.Run(view);
//initialize the controller of the APP
DeltaPregController controller = new DeltaPregController(view);
到:
//initialize the controller of the APP
DeltaPregController controller = new DeltaPregController(view);
//link the view to the APP
Application.Run(view);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句