Skip to content

DrawRectangle Method

Description

Used to draw an empty button/rectangle with the current theme and colors.

Syntax

Public Sub DrawRectangle( _
    ByVal [hDC](#) As Integer, _
    ByVal [x](#) As Integer, _
    ByVal [y](#) As Integer, _
    ByVal [cx](#) As Integer, _
    ByVal [cy](#) As Integer, _
    ByVal [Selected](#) As Boolean, _
    ByVal [Pressed](#) As Boolean, _
    ByVal [Enabled](#) As Boolean, _
    ByVal [Checked](#) As Boolean, _
    ByVal [Popuped](#) As Boolean, _
    ByVal [barType](#) As [XTPBarType](XtremeCommandBars~Enumerations~XTPBarType_EN.md), _
    ByVal [barPosition](#) As [XTPBarPosition](XtremeCommandBars~Enumerations~XTPBarPosition_EN.md) _
)

Parameters

  • hDC: Pointer to a valid device context.
  • x: Left coordinate of the item to draw. Combine with y to get the top left corner of the item to draw.
  • y: Top coordinate of the item to draw. Combine with x to get the top left corner of the item to draw.
  • cx: Right coordinate of the item to draw. Combine with cy to get the bottom right corner of the item to draw.
  • cy: Bottom coordinate of the item to draw. Combine with cx to get the bottom right corner of the item to draw.
  • Selected: Set to True if the button/rectangle should be drawn in a selected state.
  • Pressed: Set to True if the button/rectangle should be drawn in a pressed state.
  • Enabled: Set to True if the button/rectangle should be drawn in an enabled state.
  • Checked: Set to True if the button/rectangle should be drawn in a checked state.
  • Popuped: Set to True if the button/rectangle should be drawn in a "popuped" state. This is the state of a button when it is pressed and it is displaying a popup menu.
  • barType: Type of parent bar.

Bar Types

Value Description
xtpBarTypeMenuBar The command bar is a menu bar.
xtpBarTypeNormal The command bar is a normal command bar.
xtpBarTypePopup The command bar is a popup command bar.
xtpBarTypeRibbon The command bar is a Ribbon bar. When using the Ribbon bar, ActiveMenubar will return a reference to the Ribbon bar.

Bar Positions

Value Description
xtpBarTop The bar is docked to the top edge of the form.
xtpBarBottom The bar is docked to the bottom edge of the form.
xtpBarLeft The bar is docked to the left edge of the form.
xtpBarRight The bar is docked to the right edge of the form.
xtpBarFloating The bar is a floating command bar.
xtpBarPopup Not Used for dialog bar.
xtpBarListBox Not Used for dialog bar.
xtpBarComboBoxGalleryPopup The command bar will be displayed as a gallery.

Parent's bar position.

Remarks

The DrawRectangle method allows you to manually draw a button. This can be useful when using the parameters of the DrawItem event to draw custom gallery items. Typically, you would first use DrawRectangle to draw the item so that you have the correct background color, then you would draw over this with your custom item.

See Also

Example

Using DrawRectangle in the DrawItem Event to Draw Custom Gallery items


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.