当前位置: 首页>>代码示例>>C#>>正文


C# CanvasControl类代码示例

本文整理汇总了C#中CanvasControl的典型用法代码示例。如果您正苦于以下问题:C# CanvasControl类的具体用法?C# CanvasControl怎么用?C# CanvasControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CanvasControl类属于命名空间,在下文中一共展示了CanvasControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: canvasCtrl_Draw

        private void canvasCtrl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            if (!this.initialized) {
                return;
            }
            this.host.CallFunction("drawScene");
            var target = (CanvasRenderTarget)this.host.Window.Render();

            args.DrawingSession.DrawImage(target);


            if (drawCount == 0) {
                this.start = DateTime.Now;
            }
            drawCount++;
            var seconds = (DateTime.Now - this.start).TotalSeconds;
            if (seconds > 0) {
                var fps = drawCount / seconds;

                args.DrawingSession.DrawText(fps.ToString("0.#") + "fps", 10, 10, Colors.Red);
            }

            // triggers next Draw event at max 60fps
            this.canvasCtrl.Invalidate();
        }
开发者ID:modulexcite,项目名称:JsBridge,代码行数:25,代码来源:PaperJS.xaml.cs

示例2: ExportSVG

 /// <summary>
 /// Export SVG file.
 /// </summary>
 /// <param name="canvas"></param>
 /// <param name="filename"></param>
 public static void ExportSVG(CanvasControl canvas, string filename)
 {
     // Start writing SVG format.
     StreamWriter writer = new StreamWriter(filename);
     writer.WriteLine(XML_HEADER);
     writer.WriteLine(CreateSVGHeader(canvas));
     // Create brushes.
     foreach (ComponentSetting setting in canvas.Control.ComponentManager.GetAllSettings())
         writer.WriteLine(GetGradationBrush(setting));
     // Create SVG objects.
     foreach (PNode node in canvas.PCanvas.Root.ChildrenReference)
     {
         if (!(node is PPathwayLayer) || !node.Visible)
             continue;
         PPathwayLayer layer = (PPathwayLayer)node;
         foreach (PPathwayObject obj in layer.GetNodes())
             writer.WriteLine(CreateSVGObject(obj));
     }
     // Create Graph
     foreach (PNode node in canvas.ControlLayer.ChildrenReference)
     {
         if (!(node is PPathwayGraph))
             continue;
         writer.WriteLine(CreateSVGGraph((PPathwayGraph)node));
     }
     // Close SVG file.
     writer.WriteLine(SVG_FOOTER);
     writer.Flush();
     writer.Close();
 }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:35,代码来源:GraphicsExporter.cs

示例3: Canvas_Draw

        private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            var a = new Vector2(10, 10);
            var b = new Vector2(100, 100);

            args.DrawingSession.DrawLine(a, b, Colors.Yellow);
        }
开发者ID:chrisi,项目名称:IoTCanvas,代码行数:7,代码来源:MainPage.xaml.cs

示例4: POverviewCanvas

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="canvas"></param>
        public POverviewCanvas(CanvasControl canvas)
        {
            m_canvas = canvas;
            this.Dock = DockStyle.Fill;
            m_area = new PDisplayedArea();

            m_transparentNode = PPath.CreateRectangle(-500, -500, 1300, 1300);
            m_transparentNode.Brush = new SolidBrush(Color.Transparent);
            m_transparentNode.Pickable = true;

            this.AnimatingRenderQuality = RenderQuality.HighQuality;
            this.DefaultRenderQuality = RenderQuality.HighQuality;
            this.InteractingRenderQuality = RenderQuality.HighQuality;
            this.Interacting = true;

            this.Camera.AddLayer(canvas.PCanvas.Layer);
            this.RemoveInputEventListener(this.PanEventHandler);
            this.RemoveInputEventListener(this.ZoomEventHandler);
            this.Camera.AddInputEventListener(new AreaDragEventHandler(canvas.PCanvas.Camera));
            this.Camera.ScaleViewBy(REDUCTION_SCALE);
            this.Camera.TranslateViewBy(500, 500);
            this.Layer.AddChild(m_transparentNode);
            this.Layer.AddChild(m_area);
            m_ctrlLayer = this.Layer;
            this.Camera.AddLayer(this.Layer);
            this.Camera.ChildrenPickable = false;
            this.Camera.BoundsChanged += new PPropertyEventHandler(Camera_BoundsChanged);
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:32,代码来源:POverviewCanvas.cs

示例5: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var currentView = SystemNavigationManager.GetForCurrentView();

            displayRequest.RequestActive(); //to request keep display on

            currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            currentView.BackRequested += CurrentView_BackRequested;

            if (e.NavigationMode != NavigationMode.Back)
            {
                try
                {
                    _mainPageViewModel = MainPage.Current.MainPageViewModel;
                    LayoutRoot.DataContext = _mainPageViewModel;
                    _currentTrack = _mainPageViewModel.PlayingTrack;
                    _canvasControl = new CanvasControl();
                    _canvasControl.Draw += _canvasControl_Draw;
                    App.AudioPlayer.CurrentTrackChanged += AudioPlayer_CurrentTrackChanged;
                    ContentPresenter.Content = _canvasControl;
                    CreateWaveForm();
                }
                catch (Exception ex)
                {
                    ErrorLogProxy.LogError(ex.ToString());
                    ErrorLogProxy.NotifyErrorInDebug(ex.ToString());
                }
            }
        }
开发者ID:justijndepover,项目名称:Soundcloudplus,代码行数:30,代码来源:PlayingPage.xaml.cs

示例6: OnApplyTemplate

		protected override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			this._canvasControl = (CanvasControl)this.GetTemplateChild(CANVAS_CONTROL_NAME);
			this._canvasControl.Draw += OnDraw;
		}
开发者ID:lallous,项目名称:SvgForXaml,代码行数:7,代码来源:SvgImage.cs

示例7: DrawLine

        private void DrawLine(CanvasControl sender, CanvasDrawingSession ds)
        {
            var width = (float)sender.ActualWidth;
            var height = (float)sender.ActualHeight;

            var middle = height / 2;

            int steps = Math.Min((int)(width / 10), 30);

            for (int i = 0; i < steps; ++i)
            {
                var mu = (float)i / steps;
                var a = (float)(mu * Math.PI * 2);

                var color = GradientColor(mu);

                var x = width * mu;
                var y = (float)(middle + Math.Sin(a) * (middle * 0.3));

                var strokeWidth = (float)(Math.Cos(a) + 1) * 5;

                ds.DrawLine(x, 0, x, y, color, strokeWidth);
                ds.DrawLine(x, height, x, y, color, 10 - strokeWidth);
            }
        }
开发者ID:gfcprogramer,项目名称:Win2D,代码行数:25,代码来源:ShapesExample.xaml.cs

示例8: TextDirectionControl_Loaded

        void TextDirectionControl_Loaded(object sender, RoutedEventArgs e)
        {
            canvas = new CanvasControl();
            canvas.Draw += OnDraw;

            Content = canvas;
        }
开发者ID:fengweijp,项目名称:Win2D,代码行数:7,代码来源:TextDirectionControl.cs

示例9: WindowsPurchase

 public WindowsPurchase(CanvasControl _screen)
 {
     screen = _screen;
     grantedConsumableTransactionIds = new Dictionary<string, List<Guid>>();
     CurrentApp.LicenseInformation.LicenseChanged += licenseChangeHandler;
     grantedConsumableTransactionIds = new Dictionary<string, List<Guid>>();
 }
开发者ID:Pmovil,项目名称:CN1WindowsPort,代码行数:7,代码来源:WindowsPurchase.cs

示例10: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _canvasControl = GetTemplateChild(CanvasControlPartName) as CanvasControl;
            if (_canvasControl != null)
                _canvasControl.Draw += Draw;

            _contentPresenter = GetTemplateChild(ContentPresenterPartName) as ContentPresenter;
        }
开发者ID:ItsJustSean,项目名称:MaterialDesignInXamlToolkit,代码行数:10,代码来源:Shadow.cs

示例11: CanvasControl_Draw

 private void CanvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
 {
     CubeHelper helper = new CubeHelper(GetLength());
     foreach (Tuple<Vector2, Vector2> edge in helper.GetEdges(currentTransformation))
     {
         ColorValue colorValue = ColorComboBox.SelectedValue as ColorValue;
         Color color = (colorValue == null ? Colors.Black : colorValue.Color);
         args.DrawingSession.DrawLine(edge.Item1, edge.Item2, color);
     }
 }
开发者ID:jf367,项目名称:Cube,代码行数:10,代码来源:MainPage.xaml.cs

示例12: Canvas_Draw

 private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
 {
     GaussianBlurEffect effect = new GaussianBlurEffect()
     {
         Source = _bitmap,
         BlurAmount = 5,
         BorderMode = EffectBorderMode.Hard
     };
     args.DrawingSession.DrawImage(effect);
 }
开发者ID:h82258652,项目名称:SoftwareKobo.U148For10,代码行数:10,代码来源:MainView.xaml.cs

示例13: Canvas_CreateResourcesAsync

        async Task Canvas_CreateResourcesAsync(CanvasControl sender)
        {
            bitmap = await CanvasBitmap.LoadAsync(sender, "imageTiger.jpg");

            redBrush   = CreateGradientBrush(sender, 255, 0, 0);
            greenBrush = CreateGradientBrush(sender, 0, 255, 0);
            blueBrush  = CreateGradientBrush(sender, 0, 0, 255);

            brightnessEffect = new BrightnessEffect  { Source = bitmap };
            saturationEffect = new SaturationEffect  { Source = brightnessEffect };
            hueEffect        = new HueRotationEffect { Source = saturationEffect };
        }
开发者ID:ben-sheeran,项目名称:Win2D,代码行数:12,代码来源:HistogramExample.xaml.cs

示例14: BackgroundCanvas_CreateResources

        private void BackgroundCanvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(async () =>
            {
                // Load the background image and create an image brush from it
                this.backgroundImage = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Background.jpg"));
                this.backgroundBrush = new CanvasImageBrush(sender, this.backgroundImage);

                // Set the brush's edge behaviour to wrap, so the image repeats if the drawn region is too big
                this.backgroundBrush.ExtendX = this.backgroundBrush.ExtendY = CanvasEdgeBehavior.Wrap;

                this.resourcesLoaded = true;
            }).AsAsyncAction());
        }
开发者ID:r2d2rigo,项目名称:Win2D-Samples,代码行数:14,代码来源:MainPage.xaml.cs

示例15: Canvas_Draw

        void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            var ds = args.DrawingSession;
            ds.Clear(Color.FromArgb(0,0,0,0));

            var shape = this.Shapes.SelectedItem as Shape;
            if (shape == null)
                return;

            var width = sender.ActualWidth;
            var height = sender.ActualHeight;

            if (shape.Drawer != null)
                shape.Drawer(sender, ds);
        }
开发者ID:gfcprogramer,项目名称:Win2D,代码行数:15,代码来源:ShapesExample.xaml.cs


注:本文中的CanvasControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。