You are right, I should specify a bit better!
I'm working on a Windows app, not Web, with C# language.
The fact is I need this property or something that tells me width and height of the screen I'm using, including the Windows taskbar (I think this is the name in English, meaning the bar at the bottom, with start button, open applications, ...)
Thanx George, but: the Screen you mean is a class of System.Windows.Forms or a property of Microsoft.VisualBasic.Devices.Computer?
If it's the second, I think I can't use it in C# program, can I?
If it's the first, I tried to call the property Screen.Bounds but it's not static so the compiler asks me to give an object reference..which object should I use? Is there anything similar to ThisComputerWorking.Screen.Bounds?
I'll attach my piece of code:
internal void placeButtons(int[] dimensions)
{
int i = 0;
int[] dim = dimensions;
Button[,] buttons = new Button[dim[0], dim[1]];
for (int r = 0; r < dim[0]; r++)
{
for (int c = 0; c < dim[1]; c++)
{
//string str = CreateStrName(i);
buttons[r, c] = new Button();
i++;
}
}
this.SuspendLayout();
i = 0;
for (int r = 0; r < dim[0]; r++)
{
for (int c = 0; c < dim[1]; c++)
{
string str = CreateStrName(i);
//int buttH = SystemInformation.PrimaryMonitorMaximizedWindowSiz e.Height / dim[0];
//int buttW = SystemInformation.PrimaryMonitorMaximizedWindowSiz e.Width / dim[1];
//********trov come indicare le dim del tutto schermo
Rectangle rect = Screen.Bounds;
int buttH = rect.Height / dim[0];
int buttW = rect.Width / dim[1];
int x = buttW * c;
int y = buttH * r;
buttons[r, c].Location = new System.Drawing.Point(x, y);
buttons[r, c].Name = str;
buttons[r, c].Size = new System.Drawing.Size(buttW, buttH);
buttons[r, c].TabIndex = i;
buttons[r, c].Text = str;
buttons[r, c].UseVisualStyleBackColor = true;
Console.WriteLine(buttons[r, c].Name + " placed at coordinates: (" + x + "," + y + ")");
i++;
}
}
for (int r = 0; r < dim[0]; r++)
{
for (int c = 0; c < dim[1]; c++)
{
this.Controls.Add(buttons[r, c]);
}
}
}