Previous Document Next Document

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


Color.IsSame

Function IsSame(Color As Color) As Boolean

Description

Member of Color

The IsSame method returns True if the two colors are of the same color model, with equal color values.

Parameter
Description
Color
Specifies the color to compare

VBA example

The following VBA example creates two shapes, fills one with a CMYK color, and fills the other with an RGB color. The CMYK color is converted to RGB and the two colors are tested. If the two colors are the same, the first color is changed to white.

Sub Test()
 Dim s1 As Shape, s2 As Shape
 'Two shapes with a red fill from different color palettes
 Set s1 = ActiveDocument.ActiveLayer.CreateEllipse2(3, 3, 2)
 s1.Fill.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0) 'Red
 Set s2 = ActiveDocument.ActiveLayer.CreateEllipse2(6, 6, 2)
 s2.Fill.ApplyUniformFill CreateRGBColor(255, 0, 0) 'Red
 'Convert fill of s1 to the same color palette as the fill of s2
 s1.Fill.UniformColor.ConvertToRGB
 If Not s1.Fill.UniformColor.IsSame(s2.Fill.UniformColor) Then
  s1.Fill.UniformColor.RGBAssign 255, 255, 255
 End If
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.