加载窗体时,将添加UserControls 2列和多行
显示最近添加的数据
行数取决于屏幕的高度。
列数取决于屏幕的宽度
if ((int)count_columns == 2)
{
for (int sp = 0; sp <= (int)count_rows; sp++)
{
//add UserControl
latest latest1 = new latest();
latest1.Name = String.Concat("latest1_", sp.ToString());
latest1.Left = (leftPanel.Width + (int)space_between_columns);
latest1.Top = ((topPanel.Height + (32 * sp)) + (latest1.Height * sp)) + 32;
this.Controls.Add(latest1);
latest latest2 = new latest();
latest2.Name = String.Concat("latest2_", sp.ToString());
latest2.Left = (2 * (int)space_between_columns + latest2.Width + leftPanel.Width);
latest2.Top = ((topPanel.Height + (32 * sp)) + (latest1.Height * sp)) + 32;
this.Controls.Add(latest2);
}
}
尝试在UserControl上绘制渐变
private void latest1_Paint(object sender, PaintEventArgs e)
{
Pen white = new Pen(Color.White);
var rec = new Rectangle(0, 0, 500, 145);
var brush = new System.Drawing.Drawing2D.LinearGradientBrush(
rec,
Color.FromArgb(255, Color.DarkBlue),
Color.FromArgb(0, Color.DarkBlue),
90f);
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
e.Graphics.FillRectangle(brush, rec);
}
什么都没发生