Search code examples
c#winformsvisual-studio-2008compact-frameworkwindows-mobile-6

Can't resize controls with mouse in Visual Studio 2008 (C#, .NET Compact)


I am developing a windows forms application for Windows Mobile 6 in Visual Studio 2008. There is a requirement to have some common controls on each form, such as Logo (PictureBox), Title (Label) and a small description (also Label). I decided to make a FormBase with those controls and inherit other forms from that base.

The problem is that for some reason, when I drop a Button or another control on that inherited form, I cannot resize it with my mouse. I can press Shift+Arrow to resize anything with my keyboard shortcuts, but the mouse does not work.

It's not very convenient neither for me nor for other developers in my team.

Any suggestions?

Update 1

the base form:

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;
}

the inherited form:

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;
}

Solution

  • Just to close the question I will quote the answer from the comment:

    Change the base form's WindowState back to Normal for a workaround. You can still get it Maximized in the derived form. Hans Passant