Layouts are used to display all the controls on the window in a required form Layout will help us to keep the controls with same size though parent control size changes or screen resolution changes Also layouts will help us to scale the size of the controls a/c to parent control size or a/c to screen resolution Canvas Layout control Canvas Layout is the fixed layout and the controls placed in canvas layout will not increase or decrease their size when parent control size changes. Example With Canvas Controls Create a new window with the name canvas layout Crete canvas on window Design the canvas Create two buttons outside the canvas with the names b/n LTOR and btn RTOL respectively Write the following code Private void btn LTOR – click (object sender, Ronted Even Args e) { Canvas 1 Flow direction = flow direction. Left to right; } Private void btn RTOL_click() {canvas1. Flow Direction= flow direction. Right To left; } When you run the form observe the controls by increasing or decreasing the size of the window, the controls placed with the canvas will not increase or decrease their size but the controls outside canvas will increase or decrease their sizes a/c to size of the control
Stack panel layout is used to display the elements in the form of stack we can display the elements in vertical stack form or horizontal stack form
When set to Vertical : The controls will be displayed or arranged in vertical stack from when set to Horizontal: The controls will be organized in horizontal stack form
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.