Background color


Z

zidansoft

How i can get individual slide background through automation if
background is gradient ?
CShapeRange range=slide.get_Background();
CFillFormat fill= range.get_Fill();
clrF =fill.get_BackColor();
giving correct result if solid color,but gradient or pic always
giving default color .
i tried win32 call getPixel but i can't ensure that specific pixel
text or background.
I need at least one pixel color which belong to exact background.
 
Ad

Advertisements

S

Steve Rindsberg

How i can get individual slide background through automation if
background is gradient ?
CShapeRange range=slide.get_Background();
CFillFormat fill= range.get_Fill();
clrF =fill.get_BackColor();
giving correct result if solid color,but gradient or pic always
giving default color .
i tried win32 call getPixel but i can't ensure that specific pixel
text or background.
I need at least one pixel color which belong to exact background.

This is one of those cases where the macro recorder will give you almost
exactly what you need (assuming you're using 2003 or earlier).

Sub Macro1()
With ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Fill.Visible = msoTrue

' These are the properties you need:
.Fill.ForeColor.RGB = RGB(0, 0, 255)
.Fill.BackColor.RGB = RGB(255, 0, 0)

.Fill.TwoColorGradient msoGradientHorizontal, 2
End With
End Sub

You'd first want to test the shape's .Fill.Type to determine whether it's a
gradient or not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top