Hello RBischoff,
Yes, .NET Framework 1.1. All you have to do is create a C# Windows project,
drop a listbox on the form (with some space from the sides), anchor it to all
four sides and build it. Once you have verified that it behaves as expected,
go back and change the font property in designer mode and rebuild. Then the
listbox will act as if it is docked to the right and bottom.
I made no manual code changes.
Here is the form code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace AnchorTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
public System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.Label label1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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.listBox1 = new System.Windows.Forms.ListBox();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.Anchor =
((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.listBox1.Font = new System.Drawing.Font("Lucida Console",
8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.listBox1.ItemHeight = 11;
this.listBox1.Location = new System.Drawing.Point(16, 72);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(592, 279);
this.listBox1.TabIndex = 0;
//
// toolBar1
//
this.toolBar1.Divider = false;
this.toolBar1.Dock = System.Windows.Forms.DockStyle.None;
this.toolBar1.DropDownArrows = true;
this.toolBar1.Location = new System.Drawing.Point(24, 32);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(152, 40);
this.toolBar1.TabIndex = 1;
//
// label1
//
this.label1.Location = new System.Drawing.Point(216, 40);
this.label1.Name = "label1";
this.label1.TabIndex = 2;
this.label1.Text = "This is form 1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(632, 558);
this.Controls.Add(this.label1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.toolBar1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
/ken