Hi,
To create a black border:
In order to make the effect more obvious, I set a width of 10.
form2:
protected override void OnPaint(PaintEventArgs e)
{
Rectangle borderRect = new Rectangle(0, 0, Width, Height);
ControlPaint.DrawBorder(e.Graphics, borderRect, Color.Black, 10, ButtonBorderStyle.Solid, Color.Black, 10, ButtonBorderStyle.Solid, Color.Black, 10, ButtonBorderStyle.Solid, Color.Black, 10, ButtonBorderStyle.Solid);
}
be positioned to the right bottom side of the panel
Create form2 in form1.
Gets the position of the panel relative to the screen and minus the length of the message form.
Form2 messForm = new Form2();
Point panelPositionX = panel1.PointToScreen(Point.Empty);
int panelRightScreenX = panelPositionX.X + panel1.Width;
Point panelPositionY = panel1.PointToScreen(Point.Empty);
int panelDownScreenY = panelPositionY.Y + panel1.Height;
messForm.StartPosition = FormStartPosition.Manual;
messForm.Location =new Point(panelRightScreenX - messForm.Width, panelDownScreenY - messForm.Height);
messForm.ShowDialog();
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.