Previous Document Next Document

Object Model Reference : Classes : C : Color : Methods : Color.CopyAssign


Color.CopyAssign

Sub CopyAssign(Color As Color)

Description

Member of Color

The CopyAssign method copies the color model properties from a color object and applies them to the active color in CorelDRAW.

A color is an effect applied to an object that alters the object’s appearance by the way it reflects light. A color model is a system that defines the number and type of colors that make up an image and that is used to organize and define colors according to a set of basic properties that can be reproduced. Black-and-white, grayscale, RGB, CMYK, and paletted are examples of popular color modes.

Parameter
Description
Color
Specifies the color whose color model properties are copied

VBA example

The following VBA example uses a separate Color object to take an object’s fill color and convert it to RGB, then checks if the color is red (that is, its Red component value is greater than 150, and both Blue and Green values are less than 100). If this is the case, the object is filled with black. Otherwise, the object’s fill remains unchanged.

Sub Test()
 Dim c As New Color
 Dim s As Shape
 For Each s In ActiveSelection.Shapes
  If s.Fill.Type = cdrUniformFill Then
   c.CopyAssign s.Fill.UniformColor
   c.ConvertToRGB
   If c.RGBRed > 150 And c.RGBGreen < 100 And c.RGBBlue < 100 Then
    s.Fill.UniformColor.RGBAssign 0, 0, 0
   End If
  End If
 Next s
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.