質問

ようにしているのOpacityMask物件の組み合わせVisualBrushうときにドラッグ画像を別の制御などの他の画像、長方形またはその他の制御部分をイメージの制御が異なる不透明度.この画像はゼロベースは透明性、一部の画像とは別の制御異なるものはゼロ)不透明度.

これを使っているだけではVisualBrushとOpacityMask?やはより複雑なアプローチが必要ですか?

よろしく!

編集:ようにしているの画像の一部下の不透明度などの0.5)の部分をドラッグされているの制御が高く透明度など1.0).私はもともと左出しこれらの細部において重要となるアプローチを採ります。

役に立ちましたか?

解決

のほか、六本木ヒルズ大屋根の答えは、いっこを利用した不透明マスクです。まるには、次のコードを使用します虜になるLayoutUpdatedイベントのイメージです。

// Make a visual brush out of the masking control.
VisualBrush brush = new VisualBrush(maskingControl);
// Set desired opacity.
brush.Opacity = 1.0;
// Get the offset between the two controls.
Point offset = controlBeingMasked.TranslatePoint(new Point(0, 0), maskingControl);
// Determine the difference in scaling.
Point scale = new Point(maskingControl.ActualWidth / controlBeingMasked.ActualWidth, 
    maskingControl.ActualHeight / controlBeingMasked.ActualHeight);
TransformGroup group = new TransformGroup();
// Set the scale of the mask.
group.Children.Add(new ScaleTransform(scale.X, scale.Y, 0, 0));
// Translate the mask so that it always stays in place.
group.Children.Add(new TranslateTransform(-offset.X, -offset.Y));
// Rotate it by the reverse of the control, to keep it oriented correctly.
// (I am using a ScatterViewItem, which exposes an ActualOrientation property)
group.Children.Add(new RotateTransform(-controlBeingMasked.ActualOrientation, 0, 0));
brush.Transform = group;
controlBeingMasked.OpacityMask = brush;

したい場合はご希望の拠点に不透明度、イメージるもの、不透明度、別に不透明マスクこの上に座ります。ご希望の場合は拠点に不透明度よりも高い仮面の透明度を、それより使いやすくima的なアプローチが欠かせません。

の一部を、このソリューションに対して、masklessアプローチにはた場合には、マスキング制御の動きの変化、サイズ等 この自動的に迎えに変わない別の制御に同期します。

こちらはどう見えます:
(出典: yfrog.com)

他のヒント

  • ないマスク
  • 定義映像ブラシの制御
  • 塗装の形状の右上に制御するブラシ
  • ドラッグ画像 との間 の形状の制御
  • セットには透明性を磨効
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top