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 12-12-2002, 18:36
Steve
Guest
 
Posts: n/a
Default How can I change middle colors in a custom Fountain Fill

I figured out how to do the "StartColor" and "EndColor", alot of this is self explainitory, but the middle colors in a custom fountain fill are not. Using the help files I came up with...

Code:
Set ff = ActiveShape.Fill.Fountain

For Each s In ActiveSelection.Shapes
    If s.Fill.Type = cdrFountainFill Then

        For i = 0 To ff.Colors.Count + 1
            c.CopyAssign ff.Colors(i).Color
            c.ConvertToCMYK
            If ComboBox2 = "Yellow" Then
             s.Fill.Fountain.Colors(i).Color.FixedAssign cdrPANTONECoated, 1, (c.CMYKBlack)
        Next i
    End If
Next s
This is a real scaled down version of what I'm doing but it's the jist of it.

What I want it to do is go through every color in the middle of a fountain fill (Only because the 'count' wont include the first and last) and change the CMYKBlack (tint and all) to the selection of ComboBox2.

I hope I explained it ok. Any clues? Thanks Again!! This is very helpfull.
________
Iolite vaporizer review

Last edited by Steve; 12-03-2011 at 00:29.
Reply With Quote
  #2  
Old 12-12-2002, 19:56
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: How can I change middle colors in a custom Fountain Fill

Steve,

I'm not sure what kind of problem you have here. You seem to have located a proper piece of code for your purpose. Shape.Fill.Fountain.Colors is the collection containing all fill colors. It is not a normal collection in a sense that it has a "dual" nature.

All collections in the object model start with item #1 to the number of elements in the collection as identified by Count property of the collection. FountainFill.Colors lists all intermediate colors as items 1 to Count. However it has two more elements - #0 and #(Count+1) which represent the start and end color of a fountain fill.

So if you use the collection in a normal way like:

Code:
For Each fclr in ActiveShape.Fill.Fountain.Color
or

Code:
For i = 1 to ActiveShape.Fill.Fountain.Colors.Count
    Set fclr = ActiveShape.Fill.Countain.Colors(i)
Then you will loop through intermediate colors of a fountain fill only. However if you do it like in the example you used, then you will loop through all colors including the starting and ending color of the fill:

Code:
For i = 0 to ActiveShape.Fill.Fountain.Colors.Count+1
    Set fclr = ActiveShape.Fill.Countain.Colors(i)
The way you do it is correct but I'm not positive about what exactly you are trying to do. From the code you showed, it appears you try to change the fountain colors to the PANTONE Yellow coated with the tint equal to the black component of the original color? Is that what you wanted to do? If so, what kind of problems do you have because the code seems to be correct...
Reply With Quote
  #3  
Old 12-12-2002, 21:57
Steve
Guest
 
Posts: n/a
Default What I'm doing and the result

Hi Alex

Thanks for your help. First...

Code:
Set ff = ActiveShape.Fill.Fountain

For Each s In ActiveSelection.Shapes
   	 If s.Fill.Type = cdrFountainFill Then

       		 For i = 0 To ff.Colors.Count + 1
        
            		c.CopyAssign ff.Colors(i).Color
           			c.ConvertToCMYK
        
           			If (c.CMYKBlack >= 1 And c.CMYKCyan = 0 And _
           	   		c.CMYKMagenta = 0 And c.CMYKYellow = 0) Then
            
                			If ComboBox2 = "Yellow" Then 
                  			s.Fill.Fountain.Colors(i).Color.FixedAssign cdrPANTONECoated, 1, (c.CMYKBlack)

	  			End If
			End If
        		Next i
   	End If
Next s
What I'm doing is building a macro that goes through an existing template and changing the colors to the users choices from a combo box. I have all the code for the solids, outlines and simple two color fountain fills and came to a screaming halt at the intermediate fountain fill colors. The help files are helpfull but they fall short of complete.

Anyway, the program should..

-look for a fountain fill

-get the colors

-convert them to CMYK if needed (but they dont need to be I used it for the New Color)

-find out the value of the colors (in this case Black, tint 1 to 100)

-fill that color position with the chosen color (in this case Yellow) with the tint matching the tint of the found colors (black on the template)

-move on to the next

I hope that is a good explaination.

I have another small delema, but not critical. We'll get to it later.

Thanks for your help. It's very appreciated!
________
Portable vaporizer

Last edited by Steve; 12-03-2011 at 00:29.
Reply With Quote
  #4  
Old 13-12-2002, 19:11
Steve
Guest
 
Posts: n/a
Default Got it!

Code:
For Each s In ActivePage.Shapes
    If s.Fill.Type = cdrFountainFill Then
        
        Set ff = s.Fill.Fountain
        For i = 0 To ff.Colors.Count + 1
            
            ff.Colors(i).Color.ConvertToCMYK
        
            If (ff.Colors(i).Color.CMYKBlack >= 1 And _
                ff.Colors(i).Color.CMYKCyan = 0 And _
                ff.Colors(i).Color.CMYKMagenta = 0 And _
                ff.Colors(i).Color.CMYKYellow = 0) Then

               If ComboBox2 = "Yellow" Then
                    ff.Colors(i).Color.FixedAssign _
                    cdrPANTONECoated, 1, (ff.Colors(i).Color.CMYKBlack)
Thanks for the tip on the 0 to count +1! That's helpfull. I had written code for "StartColor" and "EndColor" and was trying to figure out how to do the intermediates. I was leaving out "Color" after the "Colors(i)" and it would'nt work the way I wanted it to. Imaging that.

Thanks!
________
FOCUS (NORTH AMERICA)

Last edited by Steve; 12-03-2011 at 00:29.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
object lost it's linear fountain fill property after metalickaah CorelDRAW/Corel DESIGNER VBA 5 02-01-2005 22:36


All times are GMT -5. The time now is 01:51.


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