Background color

  • Thread starter Thread starter zidansoft
  • Start date Start date
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.
 
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.
 
Back
Top