OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20-06-2003, 11:35
CORNMEN
Guest
 
Posts: n/a
Default Temporary palettes

Hello,
The problem I'm having is when I create a new palette and add a color to it. Here's what I do. Maybe there is something more to creating a palette.

Code:
dim c as color
set c = new color
dim pl as palette
pl.addcolor c
Thanks in advance for any assistance.
Mike
Reply With Quote
  #2  
Old 22-06-2003, 12:37
johndankey
Guest
 
Posts: n/a
Default Re: Temporary palettes

Quote:
Originally Posted by CORNMEN
Code:
dim c as color
set c = new color
dim pl as palette
pl.addcolor c
Mike,

One thing I can see is that you haven't actually set 'c'. It would have to have a value before you can apply a color to it. Ditto with pl, so to speak. It needs a name before you can use it. This works:
Code:
Sub doit()
Dim c As Color
Dim pl As New Palette
Set c = CreateColorEx(5002, 90, 90, 0, 0)
Set pl = Palettes.Create("mypalette.cpl")
pl.AddColor c
End Sub
Good luck,

johndankey
Reply With Quote
  #3  
Old 10-07-2003, 20:27
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Temporary palettes

Quote:
Originally Posted by johndankey
Dim pl As New Palette
Set c = CreateColorEx(5002, 90, 90, 0, 0)
Set pl = Palettes.Create("mypalette.cpl")
Very well said, however you don't need to use "New Palette" when declaring the variable. Use just:

Dim pl as Palette
...
Set pl = Palettes.Create(...)

Also, instead of using the weird CreateColorEx, use one of the more intuitive methods, such as CreateCMYKColor, CreateRGBColor, etc...

This should do it.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 23:49.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com