无法在Visual Studio 2008(C#、. NET Compact)中用鼠标调整控件的大小

德米特里·特罗菲莫夫(Dmitri Trofimov)

我正在Visual Studio 2008中为Windows Mobile 6开发Windows窗体应用程序。要求在每个窗体上具有一些通用控件,例如徽标(PictureBox),标题(Label)和简短说明(也包括Label)。我决定使用这些控件制作一个FormBase,并从该库继承其他表单。

问题是由于某种原因,当我在继承的窗体上放置一个Button或另一个控件时,无法使用鼠标调整其大小。我可以通过Shift + Arrow使用键盘快捷键来调整大小,但是鼠标不起作用。

这对我和团队中的其他开发人员来说都不是很方便。

有什么建议?

更新1

基本形式:

public class FormBase : Form
{
    public FormBase()
    {
        InitializeComponent();
    }


    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBase));
        this.pictureLogo = new System.Windows.Forms.PictureBox();
        this.labelTitle = new System.Windows.Forms.Label();
        this.panelSeparator = new System.Windows.Forms.Panel();
        this.SuspendLayout();
        // 
        // pictureLogo
        // 
        this.pictureLogo.Image = ((System.Drawing.Image)(resources.GetObject("pictureLogo.Image")));
        this.pictureLogo.Location = new System.Drawing.Point(0, 0);
        this.pictureLogo.Name = "pictureLogo";
        this.pictureLogo.Size = new System.Drawing.Size(48, 48);
        // 
        // labelTitle
        // 
        this.labelTitle.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);
        this.labelTitle.ForeColor = System.Drawing.Color.Black;
        this.labelTitle.Location = new System.Drawing.Point(54, 2);
        this.labelTitle.Name = "labelTitle";
        this.labelTitle.Size = new System.Drawing.Size(183, 16);
        this.labelTitle.Text = "Title";
        // 
        // panelSeparator
        // 
        this.panelSeparator.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));
        this.panelSeparator.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(44)))), ((int)(((byte)(75)))));
        this.panelSeparator.Location = new System.Drawing.Point(3, 50);
        this.panelSeparator.Name = "panelSeparator";
        this.panelSeparator.Size = new System.Drawing.Size(234, 1);
        // 
        // FormBase
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
        this.AutoScroll = true;
        this.BackColor = System.Drawing.Color.White;
        this.ClientSize = new System.Drawing.Size(240, 320);
        this.ControlBox = false;
        this.Controls.Add(this.panelSeparator);
        this.Controls.Add(this.labelTitle);
        this.Controls.Add(this.pictureLogo);
        this.ForeColor = System.Drawing.Color.Black;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.KeyPreview = true;
        this.Location = new System.Drawing.Point(0, 0);
        this.MinimizeBox = false;
        this.Name = "FormBase";
        this.Text = "FormBase";
        this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.PictureBox pictureLogo;
    private System.Windows.Forms.Label labelTitle;
    private System.Windows.Forms.Panel panelSeparator;
}

继承的形式:

public class FrontDoorForm : FormBase
{
    public FrontDoorForm()
    {
        InitializeComponent();
    }

    private void buttonQuit_Click(object sender, EventArgs e)
    {
        Close();
    }

    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.buttonQuit = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // buttonQuit
        // 
        this.buttonQuit.Location = new System.Drawing.Point(3, 54);
        this.buttonQuit.Name = "buttonQuit";
        this.buttonQuit.Size = new System.Drawing.Size(115, 46);
        this.buttonQuit.TabIndex = 2;
        this.buttonQuit.Text = "Quit";
        this.buttonQuit.Click += new System.EventHandler(this.buttonQuit_Click);
        // 
        // FrontDoorForm
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
        this.BackColor = System.Drawing.Color.White;
        this.ClientSize = new System.Drawing.Size(240, 320);
        this.Controls.Add(this.buttonQuit);
        this.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
        this.ForeColor = System.Drawing.Color.Black;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.Location = new System.Drawing.Point(0, 0);
        this.MinimizeBox = true;
        this.Name = "FrontDoorForm";
        this.Text = "FrontDoorForm";
        this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
        this.Controls.SetChildIndex(this.buttonQuit, 0);
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.Button buttonQuit;
}
德米特里·特罗菲莫夫(Dmitri Trofimov)

为了结束这个问题,我将引用评论中的答案

解决方法是将基本窗体的WindowState更改回Normal。您仍然可以在派生形式中将其最大化。汉斯·帕桑特

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

JSON.NET Visual Studio 2008和.NET 3.5 Compact Framework

为什么.Net Core 3.1无法在Visual Studio Community Edition 2017中用作目标框架

我无法在Visual Studio 2008上打开SQL Server Compact 3.5

在 Visual Studio 2019 中使用 C# 的 ASP.NET

无法在Visual Studio中查看C#.net的gurobi变量属性

C#Net无法发布项目,在Visual Studio 2015中成功构建

无法启动程序C:\ ... \ ****。dll VB.net应用程序Visual Studio 2015

无法初始化MFC Visual .NET 2008中的滑块控件变量

将EXT.NET设置为Visual Studio 2008

Visual Studio 2008智能设备VB.net中的Sqlite

无法使用 Visual Studio 2019 正确构建 C# 代码

Visual Studio代码-C#扩展无法识别Unity类

Visual Studio C#无法创建新的Windows窗体项目

Visual Studio for C#

错误'System.Diagnostics.Process'在Visual Studio 2008 C#中不包含'GetProcesses'的定义

C# Visual Studio 2008,将 DLL 包含到 exe 中?

将新的 .NET CORE 加载到 Visual Studio 2017 c# .NET CORE 项目中的问题

.net 3.5以上版本在Visual Studio中无法识别

Visual Studio无法识别已安装.NET Framework 4.6.2

Visual Studio 2017无法调试.Net核心Web API?

Visual Studio无法定位.NET Framework 4.8

Visual Studio 2010无法识别.NET Framework 4.0.3

无法在Visual Studio生成框架中选择.NET Core 2.2

.NET:User.IsInRole在Visual Studio中无法正常工作

Visual Studio 2017 + .Net Core 2测试无法执行

无法在Visual Studio项目属性中选择.NET Framework 4.6.1

无法在Visual Studio 2012 Ultimate上安装SSH.NET

Visual Studio无法构建为exe(.NET Core 2.0)

无法在 Visual Studio Build Framework 中选择 .NET Core 3.0