Previous Document Next Document

Object Model Reference : Classes : A : Application : Methods : Application.CreateRGBColor


Application.CreateRGBColor

Function CreateRGBColor(Red As Long, Green As Long, Blue As Long) As Color

Description

Member of Application

The CreateRGBColor method creates a color object based on the RGB color model.

Parameter
Description
Red
Specifies the level of red in the RGB color model. Values range from 0 to 255.
Green
Specifies the level of green in the RGB color model. Values range from 0 to 255.
Blue
Specifies the level of blue in the RGB color model. Values range from 0 to 255.

VBA example 1

The following VBA example creates a rectangle that covers the current page, and applies a red-to-black fountain fill to the rectangle.

Sub Test()
 Dim s As Shape
 Set s = ActiveLayer.CreateRectangle(0, 0, ActivePage.SizeWidth, ActivePage.SizeHeight)
 s.Fill.ApplyFountainFill CreateRGBColor(255, 0, 0), CreateRGBColor(0, 0, 0)
End Sub
VBA Example 2

Here is another code example:

Sub CreateColorExample()
CreateDocument
Dim sFace As Shape
Set sFace = ActiveLayer.CreateEllipse(1, 10, 8, 1.5)
sFace.Fill.UniformColor = CreateCMYKColor(0, 0, 100, 0) 'Create a yellow fill
Dim sEyeLeft As Shape
Set sEyeLeft = ActiveLayer.CreateEllipse2(3.25, 7.25, 1, -1)
sEyeLeft.Fill.UniformColor = CreateBWColor(True) 'Create a white fill
Dim sEyeRight As Shape
Set sEyeRight = ActiveLayer.CreateEllipse2(6, 7, 1, -1)
sEyeRight.Fill.UniformColor = CreateRGBColor(255, 255, 255) 'Create a white fill
Dim sEyeLeftPupil As Shape
Set sEyeLeftPupil = ActiveLayer.CreateEllipse2(3.5, 7, 0.35, -0.4)
sEyeLeftPupil.Fill.UniformColor = CreateBWColor(False)
Dim sEyeRightPupil As Shape
Set sEyeRightPupil = sEyeLeftPupil.Clone
sEyeRightPupil.Fill.ApplyFountainFill CreateHSBColor(210, 10, 10), CreateGrayColor(72), cdrConicalFountainFill
sEyeRightPupil.Move 2.75, -0.35
Dim sNose As Shape
Set sNose = ActiveLayer.CreateEllipse2(4.3, 5.4, -0.75, -0.5)
sNose.Rotate -10
sNose.Fill.ApplyFountainFill CreateCMYColor(0, 255, 255), CreateHLSColor(0, 75, 75), cdrRadialFountainFill
Dim sMouth As Shape
Set sMouth = ActiveLayer.CreateEllipse2(4.2, 3.75, 1.75, 0.75, 0, 180, True)
sMouth.Rotate -15
sMouth.Fill.ApplyFountainFill CreateYIQColor(97, 97, 100), CreateLabColor(215, -1, -2), cdrSquareFountainFill
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.