次の方法で共有


Crop.ShapeLeft プロパティ (Office)

イメージのトリミングに使用する図形の左の位置を取得または設定します。 値の取得と設定が可能です。

構文

ShapeLeft

Crop オブジェクトを返す式。

戻り値

1 行

注釈

Microsoft Word では、図形または図形の折り返しテキストが [インラインとテキスト] に設定されている場合、ShapeLeft プロパティと ShapeTop プロパティはエラーを返します。

次の例は、まず 200 x 200 のイメージを PowerPoint プレゼンテーションのスライドのほぼ中央に挿入します。 その後、枠内のイメージのサイズを 100 x 100 に変更します。 ただし、イメージの枠は 200 x 200 のままです。 次に、コードはイメージの上と右側に正方形 (既定の図形) を追加し、基本的に画像の左下隅をトリミングします。

Sub CropImage() 
 ActivePresentation.Slides(1).Shapes.AddPicture "c:\myImage.png", msoFalse, msoTrue, 250,150, 200, 200 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.PictureHeight = 100 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.PictureWidth = 100 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.PictureOffsetX = 0 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.PictureOffsetY = 0 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.ShapeHeight = 100 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.ShapeWidth = 100 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.ShapeLeft = 330 
 ActivePresentation.Slides(1).Shapes(1).PictureFormat.Crop.ShapeTop = 170 
End Sub 

関連項目

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。