ProgressBar Ocx

Purpose

Creates an Ocx ProgressBar control in the current active form, window, or dialog.

Syntax

Ocx ProgressBar name [= text$] [, id] [, x, y, b, h] [, style%]

text$:control text
id%:control identifier
x, y, b, h:iexp
style%:the control styles

Description

The ProgressBar control shows the progress of a lengthy operation by filling a rectangle with chunks from left to right.

ProgressBar control has a range and a current position. The range represents the entire duration of the operation. The current position represents the progress the application has made toward completing the operation. The Max and Min properties set the limits of the range. The Value property specifies the current position within that range. Because chunks are used to fill in the control, the amount filled in only approximates the Value property's current setting. Based on the control's size, the Value property determines when to display the next chunk.

The ProgressBar control's Height and Width properties determine the number and size of the chunks that fill the control. The more chunks, the more accurately the control portrays an operation's progress. To increase the number of chunks displayed, decrease the control's Height or increase its Width. The BorderStyle property setting also affects the number and size of the chunks. To accommodate a border, the chunk size becomes smaller. Note that any changes made to Width and Height will be negated if the Align property is changed after those changes have been made.

The Smooth property causes the control to display a contiguous progress bar instead of a segmented bar.

You can use the Align property with the ProgressBar control to automatically position it at the top or bottom of the form (basTop, basLeft, basRight, basBottom).

The Orientation property sets a value (basHorizO or basVertO) that determines whether the control is oriented horizontally or vertically. The Align property always overrules the Orientation property.

Properties

Align | Appearance | BorderStyle | Enabled | Height | HelpContextID | hWnd | Index | Left | Max | Min | MouseCursor | MouseIcon | MousePointer | Name | Orientation | Parent | Smooth | TabStop | Tag | Top | ToolTiptext | Value | Visible | WhatsThisHelpID | Width

Methods

Move | Refresh | ZOrder

Events

Click | MouseDown | MouseUp | MouseMove

Example

Local i As Int32

OpenW Center # 1, , , 400, 200

Ocx ProgressBar pro1 = "", 10, 10, 200, 40

pro1.Max = 100

pro1.Smooth = True

DoEvents

For i = 0 To 100

pro1.Value = i

Pause 1

Next

MsgBox "Ready!"

CloseW 1

Remarks

To shrink the chunk size until the progress increments most closely match actual progress values, make the ProgressBar control at least 12 times wider than its height.

See Also

Ocx, OcxOcx

Animation, CheckBox, ComboBox, Command, CommDlg, Form, Frame, Image, ImageList, Label, ListBox, ListView, MonthView, Option, RichEdit, Scroll, Slider, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown

{Created by Sjouke Hamstra; Last updated: 07/10/2017 by James Gaite}