-Windows CE programming (3rd edition)-5.2 Public controls (5)

Source: Internet
Author: User

Translation: tellmenow

Command band)
The command Belt control is a rebar control. By default, a command bar is contained in each zone of the control. The rebar control is a control container. You can drag it in the application window. The command bar is only a command bar in the rebar. Therefore, when learning how to program the command bar control, knowing how to program the command bar becomes the most learned.

Each separate belt area on the command Belt control has a "small clip", which is used to drag the belt area to a new position. The command strip can be minimized. Only the "small clip" and one icon are displayed. The command strip can also be maximized. In this case, other strip zones on the same line can be overwritten, or the command strip can be set to "Restore) "status. At this time, the screen space is shared with other zones on the same line. You can even move the command to a new line to create a multi-line command. Figure 5-4 shows a two-line command with a control at the top of the window.
Figure 5-4
The standard purpose of a command band is to separate elements in a menu, button, and other command lines into independent command bands. This allows users to reschedule these elements based on their preferences. You can also expose or stack independent commands to provide more space for menus, buttons, and other controls.

CREATE command with control
It is very easy to create command tapes. Of course, it is still a bit complicated to create command bar controls. Call the following function to create a command with a control:
Hwnd commandbands_create (hinstance hinst, hwnd hwndparent, uint WID, DWORD dwstyles, himagelist himl );
The dwstyles parameter accepts many flags to define the appearance and Operation Behavior of commands with controls. These styles are similar to those of rebar. After all, commands are closely related with controls and rebar controls.

Rbs_autosize if the widget size or position changes, the command automatically adjusts the layout.
Rbs_bandborders draw lines on each band to separate adjacent bands
Bytes --------------------------------------------------------------------------------------------------------------------
Used to list images with controls
Image list I mentioned earlier. Both the command bar and tool bar use the image list internally to manage images used on buttons. You can use the standard image list control to manage the image list. This control is basically a help control that helps applications manage a series of images of the same size. The image list controls in Windows CE are the same as those in windows and Windows ME, unless the Windows SCE version of the cursor is not supported. For the command Belt control, you only need to create an image list and add an image set that represents the minimum state. The following shows a short piece of related code:
Himl = imagelist_create (16, 16, ilc_color, 2, 0 );
Hbmp = loadbitmap (hinst, text ("cmdbarbmp s "));
Deleteobject (hbmp );
The first two parameters of the imagelist_create function are the size of the image to be loaded, the third is the image format (ilc_color is the default), and the fourth is the initial number of images in the image list, the last one is the number of images to be added. You can add two images by loading a bitmap containing the double width of two images and calling imagelist_add. After the bitmap is loaded into the image List, delete the bitmap.

Rbs_fixedorder allows the command to be moved, but the sequence remains unchanged.

When rbs_smartlabels is minimized, icons are used to represent the command band. When the command carries the restoration or maximization, the tab text rbs_varheight control shows that each row in the Bar Height of the line is adjusted to the minimum size height. When this flag is not available, the height of each row is calculated based on the highest value in the control.
Ccs_vert creates a vertical command with control
Rbs_verticalgripper shows a "small clip" for moving the vertical command bar ". This flag is ignored unless the ccs_vert flag is set.
Among these styles, rbs_smartlabels and rbs_varheight are the two most commonly used labels.

The rbs_smartlabels flag enables users to select attractive appearances for commands with controls without the need for applications to do anything. The rbs_varheight flag is very important if you use controls in the band instead of on the default command bar.

The ccs_vert style flag creates a vertical command Belt control, but because WindowsCE does not support vertical menus, the commands with menus are not correctly displayed in the vertical band. However, you can hide a special command belt when the control is in the vertical direction.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.