Previous Document Next Document

Object Model Reference : Classes : P : PatternCanvas : Properties : PatternCanvas.Pixel


PatternCanvas.Pixel

Property Pixel(x As Long, y As Long) As Boolean

Description

Member of PatternCanvas

The Pixel property returns or specifies the color of a pixel in a bitmap pattern. If this property is set to True, the pixel represents black. If it is set to False, the pixel represents white.

 
This property is equivalent to the Visual Basic PSet command, for changing and reading pixel colors.

Parameter
Description
x
Specifies the horizontal position of the pixel on the pattern canvas. This value is measured in document units.
y
Specifies the vertical position of the pixel on the pattern canvas. This value is measured in document units.

VBA example

The following VBA example inverts an existing bitmap pattern and applies both the inverted pattern and the original pattern to a rectangle.

Sub Test()
 Dim c As New PatternCanvas
 Dim x As Long, y As Long
 c.PutCopy PatternCanvases(8)
 For x = 0 To c.Width - 1
  For y = 0 To c.Height - 1
   c.Pixel(x, y) = Not c.Pixel(x, y)
  Next y
 Next x
 With ActiveLayer.CreateRectangle(0, 0, 3, 3)
  .Fill.ApplyPatternFill cdrTwoColorPattern, , 8
 End With
 With ActiveLayer.CreateRectangle(3, 0, 6, 3)
  .Fill.ApplyPatternFill cdrTwoColorPattern
  .Fill.Pattern.Canvas = c
 End With
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.