1 / 27

Custom Classes II

D101 Software Developmemt. Custom Classes II. Content. Custom Class Methods Returning Derived Values Area Height Picture Box Positioning Absolute Positioning Relative Positioning ToolTips. Learning Outcomes.

tayte
Download Presentation

Custom Classes II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. D101 Software Developmemt Custom Classes II

  2. Content • Custom Class Methods • Returning Derived Values • Area • Height • Picture Box Positioning • Absolute Positioning • Relative Positioning • ToolTips

  3. Learning Outcomes • Write custom class methods that return derived values (e.g. area, total height) • Use absolute positioning to position picture boxes • Use relative positioning to position picture boxes • Implement static and dynamic tool tip text

  4. Custom Class Methods • Derived Values: • A derived value is a value that can be figured out based on another information • It therefore does not need to be stored as it’s own value • Using derived values increase efficiency and accuracy of code

  5. Derived Values VS

  6. Derived Values VS

  7. Derived Values VS

  8. Derived Values • What is the area of these two picture boxes? • Blue is: • 10 wide • 70 high • Red is: • 70 wide • 10 high

  9. Positioning • Every C# Control has a location property • The location property consists of an X and Y integer value • These are coordinates • The X and Y values determine the location of the top left corner of the control • X is the number of pixels across • Y is the number of pixels down

  10. Positioning • The position of a picture box can be set as follows: X Y

  11. Positioning • The X and Y coordinates can be set individually using the Left and Top properties • X = Left • Y = Top

  12. Positioning • Picture Box at location 0,0

  13. Positioning • Picture Box at location 0, 40

  14. Positioning • Picture box at location 40, 0

  15. Positioning • Picture Box at location 40, 40

  16. Positioning • Example Application (absolute positioning) tbxX tbxY

  17. Positioning • Location 0,0 is in the top left corner of the From • However, for controls located inside a panel, Location 0,0 becomes the top left corner of the Panel

  18. Positioning • The Picture Box is in Location 40, 0

  19. Positioning • Horizontally centering a picture box How do we figure out where the top left corner should be? Are there other values we can derive it from?

  20. Positioning • Horizontally centering a picture box in a panel Good Reminder - Follow this link

  21. Positioning • Horizontally centering a picture box relative to another picture box

  22. Positioning • Relative Positioning

  23. Positioning • Horizontally centering a picture box relative to another picture box (relative positioning)

  24. Tool Tips • Introducing the ToolTip control

  25. ToolTips • Once a ToolTip control has been added to the project it can be used to add tool tips to multiple controls • This text shows up when the mouse hovers

  26. ToolTips • Changing the ToolTip Text dynamically at runtime

  27. Review • Can you: • Write custom class methods that return derived values (e.g. area, total height)? • Use absolute positioning to position picture boxes? • Use relative positioning to position picture boxes? • Implement static and dynamic tool tip text?

More Related