Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 8应用商店应用程序:以固定比率裁剪图像_Windows_Windows 8 - Fatal编程技术网

Windows 8应用商店应用程序:以固定比率裁剪图像

Windows 8应用商店应用程序:以固定比率裁剪图像,windows,windows-8,Windows,Windows 8,我在Windows 8应用程序上遇到了Microsoft提供的图像裁剪解决方案,但我需要的是强制用户裁剪到特定的比例(例如1:1、4:3),请建议/或提供更好的解决方案 事先非常感谢 这是解决方案(该解决方案允许用户在x,y上自由裁剪) // ///如果角点捕捉到的指针移动,选择区域将更新。 /// void Corner_PointerMoved(对象发送方,PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint pt=e.

我在Windows 8应用程序上遇到了Microsoft提供的图像裁剪解决方案,但我需要的是强制用户裁剪到特定的比例(例如1:1、4:3),请建议/或提供更好的解决方案

事先非常感谢

这是解决方案(该解决方案允许用户在x,y上自由裁剪)

//
///如果角点捕捉到的指针移动,选择区域将更新。
///  
void Corner_PointerMoved(对象发送方,PointerRoutedEventArgs e)
{ 
Windows.UI.Input.PointerPoint pt=e.GetCurrentPoint(此);
uint ptrId=pt.PointerId;
if(pointerPositionHistory.ContainsKey(ptrId)&&pointerPositionHistory[ptrId].HasValue)
{ 
点电流位置=点位置;
Point previousPosition=pointerPositionHistory[ptrId]。值;
双xUpdate=currentPosition.X—previousPosition.X;
双yUpdate=currentPosition.Y—previousPosition.Y;
this.selectedRegion.UpdateCorner((发送者作为ContentControl)。标记为string,xUpdate,yUpdate);
pointerPositionHistory[ptrId]=当前位置;
} 
e、 已处理=正确;
} 
/// <summary> 
    /// If a pointer which is captured by the corner moves,the select region will be updated. 
    /// </summary> 
    void Corner_PointerMoved(object sender, PointerRoutedEventArgs e) 
    { 

        Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(this); 
        uint ptrId = pt.PointerId; 

        if (pointerPositionHistory.ContainsKey(ptrId) && pointerPositionHistory[ptrId].HasValue) 
        { 
            Point currentPosition = pt.Position; 
            Point previousPosition = pointerPositionHistory[ptrId].Value; 

            double xUpdate = currentPosition.X - previousPosition.X; 
            double yUpdate = currentPosition.Y - previousPosition.Y; 

            this.selectedRegion.UpdateCorner((sender as ContentControl).Tag as string, xUpdate, yUpdate); 

            pointerPositionHistory[ptrId] = currentPosition; 
        } 

        e.Handled = true; 
    }