Im using:
corel.Color red = new corel.Color();
red.RGBValue = 0X0000FF;
corelApp.ActivePage.Shapes.FindShapes(null, corel.cdrShapeType.cdrNoShape, true, "@Outline.color == '" + red.ToString() + "'").AddToSelection();
All shapes that i create in code with the color red are found by findshapes, but if i create a shape and set the color in the interface (rightclick with the mouse on a color in the colorbar)
it does not find this shape, although the rgb value is the same for both colors.
if i would use the slower method:
foreach (corel.Shape sGShape in corelApp.ActivePage.Shapes) { if (sGShape.Outline.Color.IsSame(red)) sGShape.AddToSelection(); }
i did notice that
this is the color set by coreldraw interface:
corelApp.ActivePage.Shapes.First.Outline.Color {RGB255,USER,255,0,0,100,8273965b-a0fd-4e34-a5c2-a29720146cc3}
and this is the color created in code
+ red {RGB255,USER,255,0,0,100,00000000-0000-0000-0000-000000000000}
If found a solution "@Outline.color == rgb(" + blue.RGBRed + "," + blue.RGBGreen + "," + blue.RGBBlue + ")"
But i'm not there yet ;-)
IF i use blue to select it also selects all de guidelines, is there a way to avoid selecting them with findshapes?
thanks,
Tom
Why not
"@Outline.color ='red'" instead of "@Outline.color == '" + red.ToString() + "'" ?
You can also add in the CQL query:
"@type != 'guide' and @com.layer.isSpeciallayer = 'False'"
in order to also avoid everything from the master page.
I tried your suggestion:
corelApp.ActivePage.Shapes.FindShapes(null, corel.cdrShapeType.cdrNoShape, true, "@type!='guide'").AddToSelection();
but this also selects guides
then i also replaced guide by
cdrGuidelineShape which is the type i see in the code
even converted the cdrGuidelineShape to int because its in a enum
but it stays on selecting the guide.
i also tried Layer.name but it tells me that layer or Layer is a member of shape even do i se it in the watch window of the class shape.
Is it possible to see which members can be used in de cql ?
Do you mean that such a code selects also the guides?
1 2 3
Dim shR As ShapeRange Set shR = ActivePage.Shapes.FindShapes(Query:="@outline.color = 'blue' and @type != 'guide' and @com.layer.isSpeciallayer = 'False'") shR.CreateSelection
Test it in VBA and then it should not be difficult to transform it in C#, I think.
I also selects guides, which is my current problem ;-)
I see a typo in my last answer, Layer en layer are NOT a member of shape is the error i get when i try to use it. It looks like a lot of members are not implemented in cql. In basic a list can be found in the immediate window but this is not possible in c# and it looks like the are not implementing the same members.