Inheritance: Transform, ICompositeTransform
コード例 #1
0
ファイル: Avalon.cs プロジェクト: MohammedAbuissa/Avalon
 public Avalon(GeometryFactory Segments, Activation Attach, Activation Detach, ManipulationDeltaEventHandler Router,byte definition , bool Real = false)
 {
     if (!Real)
     {
         this.definition = definition;
         Data = Segments.Pattern();
         ManipulationMode = Windows.UI.Xaml.Input.ManipulationModes.All;
         RenderTransform = new CompositeTransform();
         RenderTransformOrigin = new Windows.Foundation.Point(0.5, 0.5);
         Fill = new SolidColorBrush(new Color { A = 0, R = 0, G = 0, B = 0 });
         this.Attach = Attach;
         this.Detach = Detach;
         this.Router = Router;
         Tapped += Avalon_Tapped;
         Holding += Avalon_Holding;
         Loaded += Avalon_Loaded;
         Unloaded += Avalon_Unloaded;
         ManipulationDelta += Avalon_ManipulationDelta;
         this.Real = new Avalon(Segments, Attach, Detach, null, definition,true);
         this.Real.RenderTransform = RenderTransform;
         this.Real.RenderTransformOrigin = RenderTransformOrigin;
         this.Real.Data = Segments.Pattern();
         this.Real.Fill = new SolidColorBrush(Colors.RosyBrown);
         Canvas.SetZIndex(this, 2);
         Canvas.SetZIndex(this.Real, 0);
         Avalon_Holding(null, null);
     }
 }
コード例 #2
0
ファイル: BtnGetFocusBehavior.cs プロジェクト: simple0812/uwp
        public void Attach(DependencyObject associatedObject)
        {
            //获取关联的对象
            _associatedObject = associatedObject;
            if (associatedObject == null) return;
            var obj = _associatedObject as FrameworkElement;
            if (obj == null) return;

            var ct = new CompositeTransform();
            //添加CompositeTransform缩放支持
            obj.RenderTransform = ct;

            //设置动画关联对象
            Storyboard.SetTarget(_scaleXAnim, obj.RenderTransform);
            Storyboard.SetTargetProperty(_scaleXAnim, nameof(CompositeTransform.ScaleX));

            //设置动画关联对象
            Storyboard.SetTarget(_scaleYAnim, obj.RenderTransform);
            Storyboard.SetTargetProperty(_scaleYAnim, nameof(CompositeTransform.ScaleY));

            //将动画添加到故事版
            _focuStoryboard.Children.Add(_scaleYAnim);
            _focuStoryboard.Children.Add(_scaleXAnim);

            //关联事件
            obj.PointerEntered += Obj_PointerEntered;
            obj.PointerExited += Obj_PointerExited;
        }
コード例 #3
0
        void init()
        {
            Width = DeviceWidth;
            Height = DeviceHeight;
            _elements = new List<ISlideElement>();
            //Scrol view
            _mainscroll = new ScrollViewer()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                VerticalScrollMode = ScrollMode.Auto,
                Width = DeviceWidth,
                Height = DeviceHeight,
                ZoomMode = ZoomMode.Enabled
            };
            Children.Add(_mainscroll);

            _paneltransform = new CompositeTransform();

            _contentpanel = new StackPanel()
            {
                Orientation = Orientation.Vertical,
                Width = DeviceWidth,
                RenderTransform = _paneltransform
            };
            _mainscroll.Content = _contentpanel;

        }
コード例 #4
0
ファイル: SlidableListItem.cs プロジェクト: KooKiz/comet
        /// <summary>
        /// Invoked whenever application code or internal processes (such as a rebuilding
        /// layout pass) call <see cref="OnApplyTemplate"/>. In simplest terms, this means the method
        /// is called just before a UI element displays in an application. Override this
        /// method to influence the default post-template logic of a class.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            contentGrid = this.GetTemplateChild(PART_CONTENT_GRID) as Grid;
            commandContainer = this.GetTemplateChild(PART_COMMAND_CONTAINER) as Grid;
            leftCommandPanel = this.GetTemplateChild(PART_LEFT_COMMAND_PANEL) as StackPanel;
            rightCommandPanel = this.GetTemplateChild(PART_RIGHT_COMMAND_PANEL) as StackPanel;

            transform = contentGrid.RenderTransform as CompositeTransform;

            leftCommandTransform = leftCommandPanel.RenderTransform as CompositeTransform;
            rightCommandTransform = rightCommandPanel.RenderTransform as CompositeTransform;

            contentGrid.ManipulationDelta += ContentGrid_ManipulationDelta;
            contentGrid.ManipulationCompleted += ContentGrid_ManipulationCompleted;

            contentAnimation = new DoubleAnimation();
            Storyboard.SetTarget(contentAnimation, transform);
            Storyboard.SetTargetProperty(contentAnimation, "TranslateX");
            contentAnimation.To = 0;
            contentAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(100));

            contentStoryboard = new Storyboard();
            contentStoryboard.Children.Add(contentAnimation);

            commandContainer.Background = LeftBackground as SolidColorBrush;

            base.OnApplyTemplate();
        }
コード例 #5
0
        void init()
        {
            Background = new SolidColorBrush(Colors.Transparent);
            HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;

            _transform = new CompositeTransform() { CenterX = DeviceWidth / 2, CenterY = DeviceHeight / 2 };
            RenderTransform = _transform;

            _backimage = new Image() { Stretch = Stretch.UniformToFill };
            Children.Add(_backimage);

            //just bytes
            //_blackgrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight, Background = new SolidColorBrush(Colors.Black), Opacity = 0.4 };
            //Children.Add(_blackgrid);

            //just bytes
            //_backtext = new CoverTextSlide();
            //Children.Add(_backtext);

            _pagegrid = new Grid() { Width = DeviceWidth, Height = DeviceHeight };
            Children.Add(_pagegrid);
            Canvas.SetZIndex(_pagegrid, -10);

            //just bytes
            //_loadingview = new LoadingView() { Width = 1600, Height = 900 };
            //Children.Add(_loadingview);

        }
コード例 #6
0
        void init()
        {
            Background = new SolidColorBrush(Colors.Transparent);
            VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            _transform = new CompositeTransform();
            _c_transform = new CompositeTransform();
            RenderTransform = _transform;

            //scroll
            _scroll = new ScrollViewer()
            {
                HorizontalScrollMode = ScrollMode.Enabled,
                VerticalScrollMode = ScrollMode.Enabled,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden
            };
            Children.Add(_scroll);
            //content
            _content = new Grid() { HorizontalAlignment = HorizontalAlignment.Left, ManipulationMode = ManipulationModes.All };
            _content.RenderTransform = _c_transform;
            _image = new Image() { Stretch = Stretch.UniformToFill };
            _border = new Border() { CornerRadius = new Windows.UI.Xaml.CornerRadius(10) };
            _content.Children.Add(_image);
            _content.Children.Add(_border);
            _scroll.Content = _content;
        }
コード例 #7
0
        private void ManipulableContainer_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            _transform = new CompositeTransform();
            this.RenderTransform = _transform;

            // Enable standard manipulations, without inertia to ensure they stay in view
            this.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Rotate | ManipulationModes.Scale;
        }
コード例 #8
0
 public FreeFormCanvas()
 {
     Width = 100000;
     Height = 100000;
     RenderTransform = new CompositeTransform {TranslateX = -50000, TranslateY = -50000};
     ManipulationMode = ManipulationModes.All;
     ManipulationDelta += OnManipulationDelta;
 }
コード例 #9
0
ファイル: Virtualbox.cs プロジェクト: ridomin/waslibs
        protected override void OnApplyTemplate()
        {
            _content = base.GetTemplateChild("content") as ContentPresenter;
            _clip = base.GetTemplateChild("clip") as RectangleGeometry;

            _transform = _content.RenderTransform as CompositeTransform;

            base.OnApplyTemplate();
        }
コード例 #10
0
        // 构造函数 做一些初始化工作
        public TileButton()
        {
            projection = new PlaneProjection();
            Projection = projection;
            transform = new CompositeTransform();
            RenderTransform = transform;

            ManipulationMode = ManipulationModes.Rotate | ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
        }
コード例 #11
0
ファイル: MainPage.xaml.cs プロジェクト: noriike/xaml-106136
 private double Translate(CompositeTransform s, ManipulationDeltaRoutedEventArgs e, double floor, double ceiling)
 {
     var target = s.TranslateX + e.Delta.Translation.X;
     if (target < floor)
         return floor;
     if (target > ceiling)
         return ceiling;
     return target;
 }
コード例 #12
0
 public static CompositeTransform GetCompositeTransform(this FrameworkElement elem)
 {
     var trans = elem.RenderTransform as CompositeTransform;
     if (trans == null)
     {
         trans = new CompositeTransform();
         elem.RenderTransform = trans;
     }
     return trans;
 }
コード例 #13
0
ファイル: Parallax.cs プロジェクト: molant/MangApp
        public Parallax()
        {
            background = new Image();
            backgroundTransform = new CompositeTransform();
            background.RenderTransform = backgroundTransform;
            background.Stretch = Stretch.None;

            Children.Add(background);
            Loaded += OnLoaded;
        }
コード例 #14
0
 public AbstractAffineDoubleAnimator(UIElement elem)
     : base(elem)
 {
     // Check for a transform, if it doesn't exist, make one
     if (_elem.RenderTransform == null || _elem.RenderTransform.GetType() != typeof(CompositeTransform))
     {
         _elem.RenderTransform = new CompositeTransform();
     }
     _transform = _elem.RenderTransform as CompositeTransform;
 }
コード例 #15
0
ファイル: Scenario4.xaml.cs プロジェクト: mbin/Win81App
        private void InitManipulationTransforms()
        {
            _transformGroup = new TransformGroup();
            _compositeTransform = new CompositeTransform();
            _previousTransform = new MatrixTransform() { Matrix = Matrix.Identity };

            _transformGroup.Children.Add(_previousTransform);
            _transformGroup.Children.Add(_compositeTransform);

            ManipulateMe.RenderTransform = _transformGroup;
        }
コード例 #16
0
 private void ScaleSlider_OnValueChanged(object sender, RangeBaseValueChangedEventArgs e)
 {
     if (D3DUserControl != null && ScaleSlider != null)
     {
         var transform = new CompositeTransform();
         transform.Rotation = RotateSlider.Value;
         transform.ScaleX = ScaleSlider.Value;
         transform.ScaleY = ScaleSlider.Value;
         D3DUserControl.RenderTransform = transform;
     }
 }
コード例 #17
0
        private void InitManipulationTransforms()
        {
            transforms = new TransformGroup();
            previousTransform = new MatrixTransform() { Matrix = Matrix.Identity };
            deltaTransform = new CompositeTransform();

            transforms.Children.Add(previousTransform);
            transforms.Children.Add(deltaTransform);

            // Set the render transform on the rect
            manipulateMe.RenderTransform = transforms;
        }
コード例 #18
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            CompositeTransform transform = new CompositeTransform();
            transform.Rotation = 45;
            transform.ScaleX = 0.5;
            transform.ScaleY = 0.5;
            image1.RenderTransform = transform;

            PlaneProjection project = new PlaneProjection();
            project.RotationY = 60;
            image2.Projection = project;
        }
コード例 #19
0
        public static void SetScale(FrameworkElement cell, double x, double y)
        {
            CompositeTransform transform = cell.RenderTransform as CompositeTransform;
            if (transform == null)
            {
                cell.RenderTransform = transform = new CompositeTransform();
                cell.RenderTransformOrigin = new Point(0.5d, 0.5d);
            }

            cell.RenderTransform.SetValue(CompositeTransform.ScaleXProperty, x);
            cell.RenderTransform.SetValue(CompositeTransform.ScaleYProperty, y);
        }
コード例 #20
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            scrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)GetTemplateChild(ScrollViewerControl);
            scrollViewer.ViewChanging += ScrollViewer_ViewChanging;
            scrollViewer.Margin = new Thickness(0, 0, 0, -RefreshHeaderHeight);
            var transform = new CompositeTransform();
            transform.TranslateY = -RefreshHeaderHeight;
            scrollViewer.RenderTransform = transform;

            containerGrid = (Grid)GetTemplateChild(ContainerGrid);
            pullToRefreshIndicator = (Border)GetTemplateChild(PullToRefreshIndicator);
            SizeChanged += OnSizeChanged;
        }
コード例 #21
0
        public static CompositeTransform GetCompositeTransform(this FrameworkElement elem)
        {
            if (elem == null)
            {
                throw new ArgumentNullException("elem");
            }

            var trans = elem.RenderTransform as CompositeTransform;
            if (trans == null)
            {
                trans = new CompositeTransform();
                elem.RenderTransform = trans;
            }
            return trans;
        }
コード例 #22
0
ファイル: WheelsEngine.cs プロジェクト: dolkensp/OTWB
 Windows.UI.Xaml.Shapes.Polygon Path(PathData pd, 
                                     double inc)
 {
     CompositeTransform ct = new CompositeTransform();
     ct.ScaleX = ct.ScaleY = 1;
     Windows.UI.Xaml.Shapes.Polygon p = new Windows.UI.Xaml.Shapes.Polygon();
     p.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
     p.RenderTransform = ct;
     if (!(pd is WheelsData))
         return p;
     WheelsData rd = (WheelsData)pd;
     p.Points = CalculateWheels(rd, inc);
     // now centre polygon 
     //CentrePolygon(ref p);
     return p;
 }
コード例 #23
0
        void init()
        {
            Height = DeviceHeight;
            Width = DeviceWidth;

            _mainscroll = new ScrollViewer()
            {
                VerticalScrollMode = ScrollMode.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
                HorizontalScrollMode = ScrollMode.Disabled,
                Width = DeviceWidth,
                Height = DeviceHeight
            };
            Children.Add(_mainscroll);

            _contentpanel = new StackPanel()
            {
                ManipulationMode = Windows.UI.Xaml.Input.ManipulationModes.All,
                Height = DeviceHeight,
                Orientation = Orientation.Horizontal
            };
            _mainscroll.Content = _contentpanel;

            _gridpage = new Grid() { Width = DeviceWidth, Height = DeviceHeight };
            Children.Add(_gridpage);
            //_gridpage.Opacity = 0.8;
            _pagetransform = new CompositeTransform();
            _gridpage.RenderTransform = _pagetransform;
            _pageview = new LOPageViewer();
            _gridpage.Children.Add(_pageview);

            _ctrasnform = new CompositeTransform();
            _contentpanel.RenderTransform = _ctrasnform;

            //events
            ManipulationMode = ManipulationModes.All;
            PointerPressed += LOReaderView_PointerPressed;
            PointerCanceled += LOReaderView_PointerCanceled;
            PointerReleased += LOReaderView_PointerReleased;
            ManipulationStarted += LOReaderView_ManipulationStarted;
            ManipulationDelta += LOReaderView_ManipulationDelta;
            ManipulationCompleted += LOReaderView_ManipulationCompleted;
            ManipulationInertiaStarting += LOReaderView_ManipulationInertiaStarting;
            //rigth tapped
            RightTapped += LOReaderView_RightTapped;
        }
コード例 #24
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     //define template
     String Data1 = "T|M60,143.333 C125,-81.665 185,-6.66667 325,150.833 C465,308.333 320,415.832 342.5,435.832 C365,455.832 127.5,598.331 82.5,403.332 C37.5,208.333 -4.9999,368.331 60,143.333 z_O|M102.5,125.833 L240,138.333 C240,138.333 132.5,303.333 255,273.333 C377.5,243.333 325,455.833 220,393.333 C115,330.833 102.5,125.833 102.5,125.833 z|M55,258.333 C77.5,233.333 230,153.333 130,300.833 C30,448.333 300,280.833 237.5,435.834 C175,590.835 62.5,283.333 50,290.833 C37.5,298.333 55,258.333 55,258.333 z";
     String Cats = "T|M211.111,133.889 C211.111,133.889 203.889,162.778 215.556,165 L236.667,173.333 L270,167.778 L286.667,151.667 L293.889,147.222 L304.444,176.111 C304.444,176.111 343.333,200.556 286.111,232.778 C286.111,232.778 268.889,269.444 356.666,351.667 C356.666,351.667 389.443,409.444 344.999,447.222 C344.999,447.222 336.666,453.333 356.666,461.111 C356.666,461.111 438.332,499.444 366.666,511.111 C366.666,511.111 298.333,535.555 225.555,511.111 C225.555,511.111 213.889,497.778 181.111,513.889 C181.111,513.889 86.6672,537.778 12.2232,504.444 C12.2232,504.444 -14.4431,493.889 25.0011,470 L63.3342,450.555 C63.3342,450.555 10.5568,420 39.4455,350 C39.4455,350 47.7788,330.555 59.4454,330 C59.4454,330 111.667,287.222 111.112,222.222 C111.112,222.222 114.445,209.444 96.6674,203.889 C96.6674,203.889 66.112,183.889 78.3341,160 L85.0008,115.556 L121.667,145 C121.667,145 150.556,141.111 167.778,150 L198.333,140.556 Z_O|M205.833,405.833 C205.833,405.833 213.333,461.667 276.667,460 C276.667,460 295.833,458.333 332.083,475 C332.083,475 369.167,495.417 334.167,500 C334.167,500 291.25,511.667 245,497.5 C245,497.5 233.75,496.25 245,491.25 L248.75,487.917 L245.833,482.917 C245.833,482.917 234.583,480 219.583,487.5 L208.333,491.25 L176.25,480.417 L166.667,484.583 L174.167,495 C174.167,495 98.8829,514.747 59.5013,497.829 C59.2494,497.721 58.9989,497.611 58.75,497.5 C58.75,497.5 45.4167,490.416 62.5,482.5 C62.5,482.5 94.167,463.333 117.5,458.75 C117.5,458.75 188.334,460.833 203.334,413.75 z|M196.667,201.667 C196.667,194.583 197.5,232.083 241.25,236.667 C241.25,236.667 294.583,293.75 220,346.667 L209.167,359.583 C209.167,359.583 206.25,345.833 198.333,340.833 C198.333,340.833 130,298.333 145.833,230.417 C145.833,230.417 147.5,217.083 161.25,217.083 C161.25,217.083 196.667,208.751 196.667,201.667 z";
     KarakibLab.Template t = new KarakibLab.Template(Cats);
     Debug.WriteLine((t.Children[0] as path).Data.Bounds.Height +" "+ (t.Children[0] as path).Data.Bounds.Width);
     CompositeTransform c = new CompositeTransform();
     c.ScaleX = 0.75;
     c.ScaleY = 0.75;
     for (int i = 0; i < 2; i++)
     {
         (t.Children[i] as path).RenderTransform = c;
     }
     Debug.WriteLine((t.Children[0] as path).Data.Bounds.Height + " " + (t.Children[0] as path).Data.Bounds.Width);
     Template2BitMap.templateCreator(t, I, G, 0, 0, 2);
 }
コード例 #25
0
        void init()
        {
            Height = DeviceHeight;
            Width = DeviceWidth;
            Background = new SolidColorBrush(Colors.Transparent);

            

            _mainscroll = new ScrollViewer()
            {
                VerticalScrollMode = ScrollMode.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
                HorizontalScrollMode = ScrollMode.Disabled,
                Width = DeviceWidth,
                Height = DeviceHeight,
                Background = new SolidColorBrush(Colors.Transparent)
            };
            Children.Add(_mainscroll);

            _contentpanel = new Grid()
            {
                ManipulationMode = Windows.UI.Xaml.Input.ManipulationModes.All,
                Height = DeviceHeight, 
                Background = new SolidColorBrush(Colors.Transparent)
               // Orientation = Orientation.Horizontal
            };
            _mainscroll.Content = _contentpanel;
             
            _ctrasnform = new CompositeTransform();
            _contentpanel.RenderTransform = _ctrasnform;

            //events
            //ManipulationMode = ManipulationModes.All;
            //PointerPressed += LOReaderView_PointerPressed;
            //PointerCanceled += LOReaderView_PointerCanceled;
            //PointerReleased += LOReaderView_PointerReleased;
            //ManipulationStarted += LOReaderView_ManipulationStarted;
            //ManipulationDelta += LOReaderView_ManipulationDelta;
            //ManipulationCompleted += LOReaderView_ManipulationCompleted;
            //ManipulationInertiaStarting += LOReaderView_ManipulationInertiaStarting;
            //rigth tapped
            RightTapped += LOReaderView_RightTapped;
             
        }
コード例 #26
0
        void init()
        {
            Width = DeviceWidth;
            Height = DeviceHeight;

            _elements = new List<ISlideElement>();

            //properties
            _translatedelta = 0.0;
            _thresholddelta = 0.0;
            _threshold = 0.0;

            //Scrol view
            _mainscroll = new ScrollViewer()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                VerticalScrollMode = ScrollMode.Disabled,
                Width = DeviceWidth,
                Height = DeviceHeight,
                ZoomMode = ZoomMode.Disabled
            };
            Children.Add(_mainscroll);

            _paneltransform = new CompositeTransform();

            _contentpanel = new StackPanel()
            {
                Orientation = Orientation.Vertical,
                Width = DeviceWidth,
                RenderTransform = _paneltransform
            };
            _mainscroll.Content = _contentpanel;

            //manipulation
            Background = new SolidColorBrush(Colors.Transparent);
            ManipulationMode = ManipulationModes.All;
            ManipulationCompleted += ManipulableScroll_ManipulationCompleted;
            ManipulationStarted += ManipulableScroll_ManipulationStarted;
            ManipulationInertiaStarting += ManipulableScroll_ManipulationInertiaStarting;
            ManipulationDelta += ManipulableScroll_ManipulationDelta;
            PointerPressed += ManipulableScroll_PointerPressed;
            PointerReleased += ManipulableScroll_PointerReleased;
            PointerCanceled += ManipulableScroll_PointerCanceled;
        }
コード例 #27
0
        public LineGraph( LineGraphViewModel vm )
        {
            InitializeComponent();
            RenderTransform = new CompositeTransform();
            DataContext = vm;
            vm.TimeSeries.CollectionChanged += OnTimeSeriesChanged;
            ManipulationMode = ManipulationModes.All;
            ManipulationStarting += OnManipulationStarting;
            ManipulationDelta += OnManipulationDelta;

            Loaded += delegate(object sender, RoutedEventArgs args)
            {
                xBtnCluster.PointerReleased += OnBtnClusterReleased;
                xBtnNormalize.PointerReleased += OnBtnNormalizeReleased;
                xInqCanvas.StrokeColor = Colors.White;
                xInqCanvas.StrokeAdded += OnStrokeAdded;
            };
        }
コード例 #28
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Loaded += Clr_Pckr_Loaded;

            clrViewbox = GetTemplateChild("clrViewbox") as Viewbox;
            pointer = GetTemplateChild("pointer") as Grid;
            reference = GetTemplateChild("reference") as Border;
            rtrnsfrm = GetTemplateChild("rtrnsfrm") as CompositeTransform;
            innerCanvas = GetTemplateChild("innerCanvas") as Canvas;
            innerEll = GetTemplateChild("innerEll") as Grid;
            ColorImg = GetTemplateChild("ColorImg") as Image;
           
            thumbInnerEll = GetTemplateChild("thumbInnerEll") as Thumb;
            rectColor = GetTemplateChild("rectColor") as Rectangle;
            gdStop = GetTemplateChild("gdStop") as GradientStop;
            FinalColor = GetTemplateChild("FinalColor") as Ellipse;
            testblock = GetTemplateChild("test") as TextBlock;


            ColorImg.Tapped += ColorImg_Tapped_1;
          
            rectColor.PointerPressed += Rectangle_PointerPressed_1;
            thumbInnerEll.DragDelta += Thumb_DragDelta_1;

            ColorImg.PointerReleased += ColorImg_PointerReleased_1;
            ColorImg.PointerPressed += ColorImg_PointerPressed_1;
            ColorImg.PointerMoved += ColorImg_PointerMoved_1;

            gdStop.Color = SelectedColor;
            FinalColor.Fill = new SolidColorBrush(SelectedColor);



            GeneralTransform gt = pointer.TransformToVisual(reference);

            Point p = new Point();

            p = gt.TransformPoint(p);
            px = p.X;
            py = p.Y;
            loadnew();
        }
コード例 #29
0
ファイル: OffsetPathEngine.cs プロジェクト: dolkensp/OTWB
 /// <summary>
 /// 
 /// </summary>
 /// <param name="path"></param> 
 /// <param name="x"></param>  X coordinate of starting point
 /// <param name="y"></param>  Y coordinate of starting point
 /// <returns></returns>
 public Polygon CreatePolygonFrom(RadialOffsetPath path, double rstart = 0)
 {
     Polygon p = new Polygon();
     CompositeTransform ct = new CompositeTransform();
     p.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
     p.RenderTransform = ct;
     double lastR = rstart;
     for (int i = 0; i < path.NumPoints; i++)
     {
         double angle = i * path.Increment * 2 * Math.PI;
         double r = lastR + path[i];
         double x = Math.Round(r * Math.Cos(angle),3);
         double y = Math.Round(r * Math.Sin(angle), 3);
         Point nxtPoint = new Point(x,y );
         p.Points.Add(nxtPoint);
         lastR = r;
     }
     return p;
 }
コード例 #30
0
        void initcontrols()
        {
            //level zero -  scroll backgrounds
            _elementspanel = new Grid();
            _elementspanel.Width = 1600;
            _elementspanel.Height = 900;
            _elementspanel.Background = new SolidColorBrush(Colors.Transparent);
            //_elementspanel.Orientation = Orientation.Horizontal ; 
            _elementspanel.ManipulationMode = ManipulationModes.All;
            _scrollviewer = new ScrollViewer();
            Children.Add(_scrollviewer);
            _scrollviewer.HorizontalScrollMode = Windows.UI.Xaml.Controls.ScrollMode.Enabled;
            _scrollviewer.HorizontalScrollBarVisibility = Windows.UI.Xaml.Controls.ScrollBarVisibility.Hidden;
            _scrollviewer.VerticalScrollMode = Windows.UI.Xaml.Controls.ScrollMode.Disabled;
            _scrollviewer.VerticalScrollBarVisibility = Windows.UI.Xaml.Controls.ScrollBarVisibility.Disabled;
            _scrollviewer.ZoomMode = ZoomMode.Disabled;
            _scrollviewer.Content = _elementspanel;
            _paneltransform = new CompositeTransform(); //transform fro panel scroll
            _elementspanel.RenderTransform = _paneltransform;



            //Fog Level 
            _foglevel = new Grid();
            Children.Add(_foglevel);
            _fogimage = new Image();
            _fogimage.Source = new BitmapImage(new Uri("ms-appx:///levelzero/marco.png"));
            //_foglevel.Children.Append(_fogimage);

            _foglevel.Opacity = 0.95;


            ///Color level  - image for color level
            _colorlevelimage = new Image();
            _colorlevelimage.Opacity = 0.75;
            //Children.Append(_colorlevelimage);

            _currentitem = 0;
        }