永发信息网

c#中如何让一个窗体在另一个旁边

答案:3  悬赏:10  手机版
解决时间 2021-07-16 23:36
  • 提问者网友:藍了天白赴美
  • 2021-07-16 02:02

像左边这个

最佳答案
  • 五星知识达人网友:佘樂
  • 2021-07-16 03:02

做个panel 然后


鼠标事件响应一下就行了

全部回答
  • 1楼网友:青灯有味
  • 2021-07-16 06:03

做个比较简单的

当点击窗体1的按钮,窗体2就出现在窗体1的左边

窗体1

public partial class Form1 : Form { public Form1() { InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(this.Location.X+this.Width,this.Location.Y);

//窗体2出现在左还是有,在new Form2()输入参数 f.Show(); } }

窗体2

public partial class Form2 : Form { int x = 0; int y = 0; public Form2(int x,int y) { InitializeComponent(); this.x = x; this.y = y; }

private void Form2_Load(object sender, EventArgs e) { this.Location = new Point(x, y); } }

  • 2楼网友:刀戟声无边
  • 2021-07-16 04:36

用frameset

我给你个例子!

其中的里面的 src是这个窗口页面的路径!

rows="80,*,25" 表示分三个页面(纵向),第一个高 80 第三个高25 剩下的都是第二个!

cols="200,10,*" 表示分三个页面(横向),第一个宽200 第二个宽10 乘下的都是第三个的!

这个框架里又套了一个框架,希望对你有帮助!

<frameset rows="80,*,25" cols="*" frameborder="0" id="mainframe" name="mainframe" framespacing="0"> <frame src='MainTop.aspx' name="topframe" frameborder="0" scrolling="no" noresize target="contents"> <frameset rows="*" cols="200,10,*" id="leftframe" name="leftframe" framespacing="0"> <frame src="Left.aspx" name="contents" frameborder="0" scrolling="no" noresize target="main"> <frame src="ShowHideMenu.htm" scrolling="no" noresize marginheight="0"> <frame src="BlankPage.htm" name="main" frameborder="0" scrolling="yes" noresize style="overflow-x: hidden; overflow-y: auto;"> </frameset> <frame src="MainBottom.aspx" name="bottom" frameborder="0" scrolling="no" noresize> <noframes> <body> <p>此网页使用了框架,但您的浏览器不支持框架。</p> </body> </noframes> </frameset>

你用这个的话<body>就不要了,直接用上面的代码代替<body></body>

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯