找传奇、传世资源到传世资源站!

Silverlight 颜色选择器

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

 private void SetPopupPosition()
        {
            if (colorBoard != null && Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null)
            {
                double contentheight = Application.Current.Host.Content.ActualHeight;
                double contentwidth = Application.Current.Host.Content.ActualWidth;
                double colorboardheight = colorBoard.ActualHeight;
                double colorboardwidth = colorBoard.ActualWidth;
                double pickerheight = ActualHeight;
                double pickerwidth = ActualWidth;                if (rootElement != null)
                {
                    GeneralTransform transform = rootElement.TransformToVisual(null);
                    if (transform != null)
                    {
                        Point point00 = transform.Transform( new Point(0.0, 0.0));
                        Point point10 = transform.Transform( new Point(1.0, 0.0));
                        Point point01 = transform.Transform( new Point(0.0, 1.0));                        double x00 = point00.X;
                        double y00 = point00.Y;
                        double x = x00;
                        double y = y00 pickerheight;                        if (contentheight < (y colorboardheight))
                        {
                            y = y00 - colorboardheight;
                        }
                        if (contentwidth < (x colorboardwidth))
                        {
                            x = x00 pickerwidth - colorboardwidth;
                        }                        popupDropDown.HorizontalOffset = 0.0;
                        popupDropDown.VerticalOffset = 0.0;
                        canvasOutsidePopup.Width = contentwidth;
                        canvasOutsidePopup.Height = contentheight;
                        colorBoard.HorizontalAlignment = HorizontalAlignment.Left;
                        colorBoard.VerticalAlignment = VerticalAlignment.Top;
                        Canvas.SetLeft(colorBoard, x - x00);
                        Canvas.SetTop(colorBoard, y - y00);                        Matrix identity = Matrix.Identity;
                        identity.M11 = point10.X - point00.X;
                        identity.M12 = point10.Y - point00.Y;
                        identity.M21 = point01.X - point00.X;
                        identity.M22 = point01.Y - point00.Y;
                        identity.OffsetX = point00.X;
                        identity.OffsetY = point00.Y;                        MatrixTransform matrixtransform = new MatrixTransform();
                        InvertMatrix(ref identity);                        matrixtransform.Matrix = identity;
                        canvasOutsidePopup.RenderTransform = matrixtransform;
                    }
                }
            }
        }

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复