コード例 #1
0
        private void image_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            m_Log.Debug("image_SizeChanged(...) called.");

            if (image.Source != null)
            {
                // Image has been resized.
                // Get scaling in each dimension.
                double scaleX = e.NewSize.Width / image.Source.Width;
                double scaleY = e.NewSize.Height / image.Source.Height;
                // Check that scaling factor is equal for each dimension.
                Scale = new Vector(scaleX, scaleY);
            }
            else
            {
                // Image has been removed.
                IntegrityCheck.AreEqual(0, e.NewSize.Height);
                IntegrityCheck.AreEqual(0, e.NewSize.Width);
            }
        }