A
Andrus
I created login form class below.
I have the following issues with it:
1. Log message is shown only after messagebox is displayed.
How to force text to be displayed in login form immediately after calling
Log method ?
2. Log window is displayed in top of screen.
Top = (int)(0.6 * (double)screen.WorkingArea.Height);
seems not working. How to show login form in lower part of screen ?
3. If there are more items than login area height, a scroll bar appears.
How to remove the scroll bar.
4. How to remove icon and all buttons from login form title bar ?
5. In case many messages they consume a lot of memory.
How to dispose messages (listbox items) which scroll out of login window ?
Andus.
using System;
using System.Windows.Forms;
using System.IO;
class main {
[STAThreadAttribute()]
public static void Main() {
Status s = new Status("Performing task x");
s.Log("This text is not shown immediately");
System.Threading.Thread.Sleep(8000);
MessageBox.Show ("now it is shown");
}
public class Status : Form {
ListBox lb;
public Status(string title) {
lb = new ListBox();
lb.Dock = DockStyle.Fill;
Controls.Add(lb);
Screen screen = Screen.AllScreens[0];
AutoScroll = false;
FormBorderStyle = FormBorderStyle.FixedSingle;
Text = title;
Left = 0;
Top = (int)(0.6 * (double)screen.WorkingArea.Height);
Height = screen.WorkingArea.Height / 3;
Width = screen.WorkingArea.Width;
Show();
}
public void Log(string s) {
lb.Items.Add(s);
lb.TopIndex = lb.Items.Count - 1;
}
}
}
I have the following issues with it:
1. Log message is shown only after messagebox is displayed.
How to force text to be displayed in login form immediately after calling
Log method ?
2. Log window is displayed in top of screen.
Top = (int)(0.6 * (double)screen.WorkingArea.Height);
seems not working. How to show login form in lower part of screen ?
3. If there are more items than login area height, a scroll bar appears.
How to remove the scroll bar.
4. How to remove icon and all buttons from login form title bar ?
5. In case many messages they consume a lot of memory.
How to dispose messages (listbox items) which scroll out of login window ?
Andus.
using System;
using System.Windows.Forms;
using System.IO;
class main {
[STAThreadAttribute()]
public static void Main() {
Status s = new Status("Performing task x");
s.Log("This text is not shown immediately");
System.Threading.Thread.Sleep(8000);
MessageBox.Show ("now it is shown");
}
public class Status : Form {
ListBox lb;
public Status(string title) {
lb = new ListBox();
lb.Dock = DockStyle.Fill;
Controls.Add(lb);
Screen screen = Screen.AllScreens[0];
AutoScroll = false;
FormBorderStyle = FormBorderStyle.FixedSingle;
Text = title;
Left = 0;
Top = (int)(0.6 * (double)screen.WorkingArea.Height);
Height = screen.WorkingArea.Height / 3;
Width = screen.WorkingArea.Width;
Show();
}
public void Log(string s) {
lb.Items.Add(s);
lb.TopIndex = lb.Items.Count - 1;
}
}
}