Changing the Skin Code for the Progress Bar (Windows CE 5.0)

Windows CE 5.0
Send Feedback

In Cloning the Commctrl Module, you made a local copy of the skin code for all common controls for use with your run-time image. The following code shows the changes you can make to the local copy of the progress bar skin code, Progressview.cpp.

These changes cause the progress bar to advance from the right to the left rather than from left to right. The code in Progressview.cpp provides the implementations in your run-time image for the methods in the ProgressBarView_t interface.

To change the progress bar code

  1. Select the FileView tab. Expand the Projects node, and navigate to CommctrlView\Source Files. Double-click the Progressview.cpp file in the list of source files.

    The window for this source file opens.

  2. The following code provides a schematic view of the code in Progessview.cpp and shows the two sections of the drawing code that you should delete and replace.
    void ProgressBarView_t::Draw(  /* ... Parameters ... */ )
    {
    // Variable declarations.
    /* ... */
    
    // Find the device context.
    /* ... */
    
    // Determines and sets the size and parameters of the control.
    /* ... */
    
      for ( i = 0; i < nBlocks; i++ )
      {      
        if ( dwStyle & PBS_VERTICAL )
        {         
          // Calculations for a vertical progress bar.
          /* ... */
        }
        else
        {
          // Calculations for a horizontal progress bar.
    
          // ----- Original code for drawing left-to-right -----
          // Delete:  rc.right = rc.left + dxBlock;
          // Delete:  // Are we past the end?
          // Delete:  if (rc.left >= rcClient.right)
          // Delete:  {
          // Delete:    break;
          // Delete:  }
          // Delete:  
          // Delete:  if (rc.right >= rcClient.right) 
          // Delete:  {
          // Delete:    rc.right = rcClient.right - 1;
          // Delete:  }
          // ---------------------------------------------------
    
    
          // ======== New code for drawing right-to-left =======
    
          rc.left = rc.right - dxBlock;
    
          // Check to see if the bar is already starting
          // after the end of its range.
          if (rc.right <= rcClient.left)
          {
            break;
          }
    
          if (rc.left <= rcClient.left) 
          {
            rc.left = rcClient.left - 1;
          }
          // ===================================================
    
        }
            
        // Make the actual drawing call.
        /* ... */
            
        if (dwStyle & PBS_VERTICAL) 
        {
          // Advance a vertical progress bar.
          /* ... */
        } 
        else 
        {
          // ----- Original code for drawing left-to-right -----
          // Delete:
          // Delete:  rc.left = rc.right + dxSpace;
          // Delete:
          // ---------------------------------------------------
    
    
          // ======== New code for drawing right-to-left =======
    
            rc.right = rc.left - dxSpace;
    
          // ===================================================
          }
        }
    
        // Cleanup.
        /* ... */
    
      }
    }
    
  3. From the File menu, choose Save, and then Close to close the File.

See Also

How to Customize the Appearance of Common Controls | ProgressBarView_t


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: