C
C#2w ago
Silme94

FlowLayoutPanel TopDown problem

When FlowDirection is to TopDown, nothing shows to the screen, but when FlowDirection is to LeftToRight, it shows the created Panel 'qPanel' but this is not what i want
Panel panel = new Panel()
{
Size = new Size(643, 362),//643, 426),
Location = new Point(0, 0),
BackColor = Color.Transparent,
Name = "Q",
Dock = DockStyle.Fill
};

FlowLayoutPanel q = new FlowLayoutPanel()
{
Size = new Size(633, 352), //392),
Location = new Point(10, 10),
BackColor = Color.Transparent, //Color.FromArgb(63, 98, 227),
Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left,
FlowDirection = FlowDirection.TopDown,
AutoScroll = true,
AllowDrop = true,
WrapContents = false,
AutoSizeMode = AutoSizeMode.GrowAndShrink,
};

q.VerticalScroll.Visible = true;

Thematic thematic = Database.db.RetrieveThematicInfo(Database.db.GetThematicId(thematicName));

foreach (var theme in thematic.Themes)
{
Panel qPanel = new Panel()
{
Size = new Size(q.ClientSize.Width - 20, 45),
BackColor = Color.FromArgb(63, 98, 227),
Anchor = AnchorStyles.Left | AnchorStyles.Right,
Margin = new Padding(0, 0, 0, 10),
};

Label themelabel = new Label()
{
Text = theme.Name,
Location = new Point(13, 12),
TextAlign = ContentAlignment.MiddleCenter,
Font = new Font("Arial Rounded MT Bold", 13),
Anchor = AnchorStyles.Left,
AutoEllipsis = true,
AutoSize = true,
ForeColor = Color.FromArgb(225, 226, 208)
};

MaterialButton start = new MaterialButton()
{
Text = "START",
Cursor = Cursors.Hand,
Location = new Point(qPanel.Width - 100, 5),
ForeColor = Color.FromArgb(225, 226, 208),
BackColor = Color.FromArgb(115, 133, 222),
Anchor = AnchorStyles.Right
};

qPanel.Controls.Add(themelabel);
qPanel.Controls.Add(start);
q.Controls.Add(qPanel);
}
Panel panel = new Panel()
{
Size = new Size(643, 362),//643, 426),
Location = new Point(0, 0),
BackColor = Color.Transparent,
Name = "Q",
Dock = DockStyle.Fill
};

FlowLayoutPanel q = new FlowLayoutPanel()
{
Size = new Size(633, 352), //392),
Location = new Point(10, 10),
BackColor = Color.Transparent, //Color.FromArgb(63, 98, 227),
Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left,
FlowDirection = FlowDirection.TopDown,
AutoScroll = true,
AllowDrop = true,
WrapContents = false,
AutoSizeMode = AutoSizeMode.GrowAndShrink,
};

q.VerticalScroll.Visible = true;

Thematic thematic = Database.db.RetrieveThematicInfo(Database.db.GetThematicId(thematicName));

foreach (var theme in thematic.Themes)
{
Panel qPanel = new Panel()
{
Size = new Size(q.ClientSize.Width - 20, 45),
BackColor = Color.FromArgb(63, 98, 227),
Anchor = AnchorStyles.Left | AnchorStyles.Right,
Margin = new Padding(0, 0, 0, 10),
};

Label themelabel = new Label()
{
Text = theme.Name,
Location = new Point(13, 12),
TextAlign = ContentAlignment.MiddleCenter,
Font = new Font("Arial Rounded MT Bold", 13),
Anchor = AnchorStyles.Left,
AutoEllipsis = true,
AutoSize = true,
ForeColor = Color.FromArgb(225, 226, 208)
};

MaterialButton start = new MaterialButton()
{
Text = "START",
Cursor = Cursors.Hand,
Location = new Point(qPanel.Width - 100, 5),
ForeColor = Color.FromArgb(225, 226, 208),
BackColor = Color.FromArgb(115, 133, 222),
Anchor = AnchorStyles.Right
};

qPanel.Controls.Add(themelabel);
qPanel.Controls.Add(start);
q.Controls.Add(qPanel);
}
No description
1 Reply
Silme94
Silme946d ago
please can someone help