Share via


PictureType Property (ModHFGrid)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns or sets the type of picture to be generated by the Picture property.

Syntax

object.PictureType [=type]

The PictureType property syntax has these parts:

Part Description
object An object expression that evaluates to the ModHFGrid Control object.
type An integer or constant that specifies the type of picture that should be generated, as described in Settings.

Settings

The settings for type are:

Constant Value Description
flexPictureColor 0 This produces a high-quality full-color image.
flexPictureMonochrome 1 This produces a lower-quality, monochrome, image that consumes less memory.

Example

The following code shows how you can trap out-of-memory errors and switch to monochrome mode automatically using the PictureType property. In addition, it shows how to create a picture within the ModHFGrid that includes only the current selection.

Sub CopySelectedPictureToClipboard (myFlex As _
ModHFGrid)
   Dim i As Integer, tr As Long, lc As Long, _
   hl As Integer
   ' Get ready to operate.
   MyFlex.Redraw =False   ' To eliminate flicker.
   hl =MyFlex.HighLight   ' Save current settings.
   tr =MyFlex.TopRow
   lc =MyFlex.LeftCol
   MyFlex.HighLight =0   ' No highlight on picture.
   ' Hide nonselected rows and columns.
   ' (Save original sizes in RowData/ColData 
   ' properties.)
   For i =MyFlex.FixedRows To MyFlex.Rows - 1
      If i < MyFlex.Row Or i > MyFlex.RowSel Then
         MyFlex.RowData(i) =MyFlex.RowHeight(i)
         MyFlex.RowHeight(i) =0
      End If
   Next
   For i =MyFlex.FixedCols To MyFlex.Cols - 1
      If i < MyFlex.Col Or i > MyFlex.ColSel Then
         MyFlex.ColData(i) =MyFlex.ColWidth(i)
         MyFlex.ColWidth(i) =0
      End If
   Next
   ' Scroll to top left corner.
   MyFlex.TopRow =MyFlex.FixedRows
   MyFlex.LeftCol =MyFlex.FixedCols
   ' Copy picture.
   clipboard.Clear
   On Error Resume Next
   MyFlex.PictureType =0 ' Color.
   clipboard.SetData MyFlex.Picture
   If Error <> 0 Then
      MyFlex.PictureType =1 ' Monochrome.
      clipboard.SetData MyFlex.Picture
   Endif
   ' Restore control.
   For i =MyFlex.FixedRows To MyFlex.Rows - 1
      If i < MyFlex.Row Or i > MyFlex.RowSel Then
         MyFlex.RowHeight(i) =MyFlex.RowData(i)
      End If
   Next
   For i =MyFlex.FixedCols To MyFlex.Cols - 1
      If i < MyFlex.Col Or i > MyFlex.ColSel Then
         MyFlex.ColWidth(i) =MyFlex.ColData(i)
      End If
   Next
   MyFlex.TopRow =tr
   MyFlex.LeftCol =lc
   MyFlex.HighLight =hl
   MyFlex.Redraw =True
End Sub

See Also

Picture Property (ModHFGrid) | ModHFGrid Control