Ask Your Question
1

How to create a Form that can be resized and has no border, but is controlled by a top "Panel" object with the Dock property set to Top?

asked 2023-05-31 19:51:21 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-31 20:13:01 +0000

david gravatar image
  1. Create a new Windows Forms project in Visual Studio.
  2. Add a new Form to the project and set its BorderStyle property to None.
  3. Add a Panel to the top of the Form and set its Dock property to Top.
  4. Add any desired controls to the Panel and set their Dock or Anchor properties as needed.
  5. Add an Event Handler for the Form's Resize event.
  6. In the Resize event handler, set the size and location of the Panel based on the Form's current size and the desired height of the Panel.
  7. Set the SizeGripStyle property of the Form to Show to allow the user to resize the Form.
  8. Test the Form to ensure that it can be resized and that the Panel remains docked to the top of the Form.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-31 19:51:21 +0000

Seen: 1 times

Last updated: May 31 '23