c# - 如何允许用户调整窗口大小?

标签 c# winforms c#-4.0

目前,当有人使用我的应用程序时,如果他们调整了它的大小,那么除了窗口之外的所有内容都停留在同一个地方并且看起来很丑陋。我如何调整它的大小,以便一切都相互关联?这是代码:

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 BroZer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Reload_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }

        private void Go_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }

        private void Back_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
        }

        private void Forward_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            webBrowser1.Navigate("https://www.google.com/search?&ie=UTF-8&q=" + textBox1.Text);
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }

        private void Save_Click(object sender, EventArgs e)
        {
            webBrowser1.ShowSaveAsDialog();
        }
    }
}

最佳答案

如果您使用的是 WinForms,您可以使用 anchoring and docking用于动态调整大小。

关于c# - 如何允许用户调整窗口大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11321038/

相关文章:

c# - WCF 数据服务更新返回 401-未经授权 : Access is denied due to invalid credentials

c# - 如何从类库进行通信

c# - 从 MySQL 中检索中型 blob 仅返回 13 个字节

c#-4.0 - 如何为快捷键实现键盘处理程序 cefSharp

c# - 删除查询中的重复代码

c# - 使用复杂类型调用存储过程 Entity Framework 动态结果集

c# - 将 lambda 表达式组合到属性路径

c# - 这把锁有什么问题?

c# - 将新颜色(带渐变)应用于 Win Forms 按钮 onClick

c# - 使用正则表达式处理异常的问题