다음 코드 두 개가 있습니다. 한 번 살펴 보겠습니다. 잘못된 점을 지적했습니다. 두 번째 창이라고 부르는 기능을 제거 했으므로 여기서 의미가 없습니다.공용 함수가 제대로 작동하지 않습니다.
먼저, 기본 양식은이 양식이 두 번째 양식 호출
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace STP_Design
{
public partial class STP2Main : Form
{
public STP2Main()
{
InitializeComponent();
tabControl1.SelectedTab = tabPageDeviceManager;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
MenuForm MDIMF = new MenuForm();
MDIMF.MdiParent = this;
MDIMF.StartPosition = FormStartPosition.Manual;
MDIMF.Location = new Point(3, 50);
MDIMF.Show();
tabControl1.Visible = false;
}
public void set()
{
tabControl1.Visible = true; // This statement executes, but does not result in anything I'd expect. The debugger tells me the visibility is false.
tabControl1.BringToFront();
}
}
}
와 두 번째 형태, 나는 닫고 첫 번째 폼 업데이트해야합니다 :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace STP_Design
{
public partial class MenuForm : Form
{
public MenuForm()
{
InitializeComponent();
this.BringToFront();
}
private void button1_Click(object sender, EventArgs e)
{
STP2Main stp = new STP2Main();
stp.set();
this.Close();
}
}
}
표시되는 동작은 무엇입니까? – itsmatt
"두 번째 창 호출"코드가 매우 중요 할 수 있습니다. – Rawling
STP2Main을 실제로 표시하는 코드는 어디에 있습니까? –