dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Label not showing in form


From: Mike Peters
Subject: [DotGNU]Label not showing in form
Date: Thu, 12 Jun 2003 17:58:01 +0300

I've finally managed to update my cvs after 3 weeks of extremely flakey
internet connectivity and so I celebrated by having a play about with
the new Forms stuff. I'm doing this at work in the odd 5 or 10 minutes I
can grab here and there and I haven't got a clue about Windows Forms so
you'll have to excuse me if I'm missing something obvious.

I grabbed a tutorial off the net and decided to see if I could get it to
work. It works to a point with the enclosed patch to
System.Windows.Forms/Label.cs except the label doesn't display. What's
missing? I'll have another, proper, look when I get home from work (in
another couple of hours and internet connection permitting) but until
then if anyone wants to............

The tutorial code pretty much unmodified:

/*********************************************
* LabelForm.cs - Sample/Test Form with a Label 
*/

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

public class LabelForm : Form
{
        Label label1;
        
        private LabelForm()
        {
          label1 = new Label();

          label1.UseMnemonic = true;
          label1.Text = "First &Name:";
          label1.Location = new Point(15,15);
          label1.BackColor = Color.Pink;
          label1.ForeColor = Color.Maroon;
          label1.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
          label1.Size = new Size (label1.PreferredWidth,
label1.PreferredHeight + 2);

          //Text to be Displayed in the Caption-Title Bar
          this.Text = "Form Tutorial No.4 From JAYANT";
          //this.StartPosition = FormStartPosition.CenterScreen;  <-
this doesn't work
          this.AutoScaleBaseSize = new Size(5,13);
          this.ClientSize = new Size(300, 200); //Size except the Title
Bar-CaptionHeight
          //this.MinTrackSize = new Size(300, (200 +
SystemInformation.CaptionHeight) );   <- nor does this
          this.AutoScroll = true;
          this.MaximizeBox = false;

          label1.Show();
          this.Controls.Add(label1);
        }

        public static void Main(String[] args)
        {
                LabelForm form = new LabelForm();
                form.Width = 400;
                form.Height = 250;
                Application.Run(form);
        }
}

-- 
Mike
Web Site: http://www.ice2o.com/
JabberID: address@hidden
Registered Linux User #247123

"A thousand years ago we thought the world was a bowl. Five hundred
years ago we knew it was a globe. Today we know it is flat and round
carried through space on the back of a turtle. Don't you wonder what
shape it will turn out to be tomorrow?" [Lord Vetinari] 
(The Truth)

Attachment: mike-030612.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]