I would like to create a command to set all new shapes as hairline in rgb red.
The same effect as the user double click on the pen symbol (default values for Graphic)
You could try this:
Sub set_default_graphic_outline_hairline_RGB_red() Dim styleThis As Style Set styleThis = ActiveDocument.StyleSheet.FindStyle("~graphic~") styleThis.Outline.Width = ActiveDocument.ToUnits(762, cdrTenthMicron) styleThis.Outline.Color = Application.CreateRGBColor(255, 0, 0) End Sub
Ok i am not sure what i do it wrong, but i am wrong.....Why do I have to create an object? can't I just assign it?
1 2 3 4 5 6 7 8
private void set_new_graphic_default_outline_hairline_RGB_red() { Style styleThis = new Style(); styleThis = corelApp.ActiveDocument.StyleSheet.FindStyle("~graphic~"); corelApp.ActiveDocument.ToUnits(762, corel.cdrUnit.cdrTenthMicron); corelApp.ActiveDocument.Application.CreateRGBColor(255, 0, 0); }
You are correct. You don't have to create an object.
Sub set_default_graphic_outline_hairline_RGB_red() ActiveDocument.StyleSheet.FindStyle("~graphic~").Outline.Width = ActiveDocument.ToUnits(762, cdrTenthMicron) ActiveDocument.StyleSheet.FindStyle("~graphic~").Outline.Color = Application.CreateRGBColor(255, 0, 0) End Sub
Many thanks for your help. This works perfectlyCan you explain me what is"~graphic~" ?Or where i can find this things. I canot find any documentation.
Remo Gwerder said:Can you explain me what is"~graphic~" ?
I was using StyleSheet.FindStyle to get the style for default object properties for new graphic objects. For doing that, "~graphic~" is the name of that style.
I don't remember where I learned that. In general, I don't think I have a very good understanding of how to work with styles using the API!