1 / 19

More Control Properties

More Control Properties. Part 10 dbg. Form Properties that Affect TitleBar. ControlBox Property (T/F) Do you display the icon, associated menu to the left, and buttons to right of the Text Property of form?

aderes
Download Presentation

More Control Properties

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. More Control Properties Part 10 dbg

  2. Form Properties that Affect TitleBar • ControlBox Property (T/F) • Do you display the icon, associated menu to the left, and buttons to right of the Text Property of form? • Yes allows keyboard access (Alt + spacebar) to close, move, resize, minimize, maximize, restore. • Icon Property (.ico file) • Substitute a particular .ico graphic file as the ControlBox icon.  Icon

  3. Form Properties that Affect TitleBar • MaximizeBox Property (T/F) • determines whether or not the form can be maximized. • MaximizeButton is dimmed when false. • MinimizeBox Property(T/F) • detemines whether or not the form can be minimized. • MinimizeButton is dimmed when false.  ControlBox

  4. More Form Properties • MinimumSize (Width in pixels, Height in pixels) --- This is the smallest possible size of form. • ShowInTaskBar (T/F) --- Do you want this form to display a taskbar button, listing this form as a “running application”? • WindowState (Normal, Minimized, Maximized) --- Should this form should have its normal size, be minimized at startup, or be maximized at startup?  TaskBarItem

  5. Position of Controls when Form is Resized • When a user resizes a form by dragging the border or SizeGrip, form controls will “float” to new positions on form. • To control this “floating”, set Anchor Property (top, left, bottom, right). This keeps control in same place relative to anchored side(s). • You may select multiple sides to anchor to. • When form is resized, control will stay the original (design) distance from specified side(s).

  6. Position of Controls when Form is Resized • Dock Property (top, left, bottom, right, none). This causes the size of control to expand or contract to match the size of docked side. • Dock Padding Property (pixels). This distance between control and docked side will not change as form is resized.  Dock

  7. Different Looks for RadioButtons and CheckBoxes • You can alter the look of a traditional CheckBox by setting the Appearance Property to Button. Toggling the “Button” will alter the Checked Property of the CheckBox. • You can alter the appearance of a RadioButton by setting the Appearance Property to Button. Clicking a “Button” will alter the Checked Property of the RadioButton. • The Image and BackColor properties can be adjusted, for effect, if desired.  ToggleCheck  ToggleRadio

  8. TrackBar and ScrollBar Controls Filled with a Number Series

  9. TrackBar Properties • A TrackBar is a control that can conveniently display a range of values. • How far apart the Ticks appear is set in the TickFrequency Property. • The look of the Thumb and Ticks is set in the TickStyle Property. • Set lowest value for TrackBar in Minimum Property. Set highest value for TrackBar in Maximum Property. • Starting Value of the Thumb is set in the Value Property.

  10. User Interaction with TrackBar • The user drags the Thumb to change the TrackBar Value Property. The minimal amount the Value Property can change is determined by the SmallChange Property. • The user can also click on the TrackBar. Clicking to left of Thumb decreases the TrackBar Value Property by the LargeChange Property amount. Clicking to the right of Thumb increases TrackBar Value Property by the LargeChange Property amount.

  11. TrackBar • When the Value Property of the TrackBar is changed, the Scroll event “fires”. • The TrackBar control does not display the actual value chosen. Good design dictates that the Value be displayed in a Label control. • Use the prefix tkb with the TrackBar.  NormalTrackBar

  12. Unusual TrackBars • Normally the values of a TrackBar are increasing left to right. However, you may have a TrackBar with values decreasing from left to right by setting the RightToLeft Property to Yes. • Whether the TrackBar is vertical or horizontal is set in the Orientation Property. • To produce a regular series of non-contiguous values, multiply or divide the Value Property, as necessary.  NoncontiguousTrackBar  TrackBar2

  13. The Resize Event Handler • The previous example stops working correctly if the form is resized. • Program the Resize event handler of the form to update the Maximum Properties of the TrackBar controls with the new ClientSize dimensions.  Resize

  14. ScrollBar • There are two separate ScrollBar controls for vertical (vsb prefix) and horizontal (hsb prefix) orientations. • The Thumb of the ScrollBar control is a box rather than a pointer. There are no Ticks. • The SmallChange Property controls the change produced by clicking on the end arrows of the control. • Usage is otherwise similar to the TrackBar.  ScrollBars

  15. Random Numbers

  16. Random • For small ranges of values, instantiating a Random object is adequate to generate unique sequences of numbers. • For very large random numbers (3, 4, 5, 6, 7 etc digits) or if you are running on a very fast system, it may be necessary to seed the Randomobject with a value derived from the system clock to insure that a pseudorandom sequence is unique. • Random rand = newRandom(); • -or- • Random rand = newRandom((int)DateTime.Now.Ticks);

  17. Next() Method • The Next() method of the Random object delivers a random integer. • The method is overloaded and can accept 0, 1 or 2 arguments. • With no arguments, integers between 0 and 2,147,483,647 are delivered. rand.Next();

  18. Next() Method • With a single argument, integers between 0 and argument -1 are delivered. rand.Next(6);//delivers integers in the range 0 to 5 • With two arguments, integers between argument1 and argument2 -1 are delivered. rand.Next(2,8);//delivers integers in the range 2 to 7  RandomInteger  IfElseRandom  SwitchRandom

  19. NextDouble() Method • NextDouble() does not take arguments. • Values produced are greater than or equal to 0.0 and less than 1.0 . • To obtain double precision values in some other range, multiply the random double by some upper limit value. • To adjust the lower limit, subtract the lower limit from the upper limit multiplier and then add the lower limit to the product of the random double and the multiplier.  RandomDoubles

More Related