مقرر VISUAL PROGRAMMING LECTURE 2 DR. AMIR MOHAMED ELAMIR 2 DR.AMIR MOHAMED ELAMIR 26/11/2023 INTRODUCTION • Prior to creating a Visual Basic 2019 project, you need to conceive an idea of what kind of project you intend to develop. • Maybe you want to develop a desktop game, a multimedia app, a financial app, a database management app and so forth. • Once you have decided on the app you wish to develop, the first step is to design the User Interface(UI). • To design the UI, we suggest you sketch it first on a piece of paper before working on it in the VB2019 IDE. • After completed and refined your design on paper, then only you start designing the app on the VB2019 IDE. Customizing the Default-Form When you start a new Visual Basic 2019 project, the IDE will display the default form along with the Solution Explorer window and the Properties window on the far right, as shown in Figure 2.1. Changing the Properties of the DefaultForm at Run-Time Enhancing the UI • In this lesson, we shall enhance the UI by adding controls to the default Form. • Controls are objects that consist of three elements, namely properties, methods, and events. • They can be added to the Form from the Toolbox. Among the controls, the most common ones are the button, label, text box, list box, combo box, PictureBox, checkbox, radio and more. • We can make the controls visible or invisible at runtime. However, some controls will only run in the background and invisible at runtime, one such control is the timer. • To add a control to the Form, just drag the control from the toolbox and drop it onto the Form. You can drag the control around the form and also resize it. The Toolbox • The Toolbox is usually is hidden when you start Visual Basic 2019. • You can click View on the menu bar and then select Toolbox to reveal the toolbox. • Besides that, you can also use shortcut keys Ctrl+Alt+x to bring out the toolbox. You can drag and dock the Toolbox around the IDE. It is docked at the left of the IDE window. • You can change the position of the toolbox by dragging it to anywhere you like while its status is set to float. • You can also dock the toolbox by right-clicking on the toolbox and choose dock from the pop-up menu. • The docked toolbox that appears as a tabbed document with the default Form • In addition, you may also pin the toolbox to the sidebar or the bottom bar by clicking on the pin icon on the menu bar of the toolbox. • How and where you want to position your toolbox in Visual Basic 2019 IDE is entirely up to you but I strongly suggest that you place the toolbox alongside or at the bottom of the default form so that it is easy for you to add controls from the toolbox into the form. • You should never cover the form with the toolbox because it will be difficult to add controls to the form. Designing the UI of a Picture Viewer • In this section, we shall demonstrate how to design a picture viewer. • First, change the title of the default form to Picture Viewer in its properties window. • Next, drag the PictureBox control to the Form and change its background color to white. To do this, right-click the PictureBox and select properties in the popup menu, then look for the BackColor Property in the Properties window. • Next, add two buttons to the form and change the text to Load Picture and Close in their respective properties windows. • Now, we have designed a basic picture viewer in VB2019. We shall add more features later. The picture viewer is not functional until we write code to respond to events triggered by the user. • We will deal with the coding part in another lesson The UI is shown in