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


C# IDrawable.Draw方法代码示例

本文整理汇总了C#中IDrawable.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# IDrawable.Draw方法的具体用法?C# IDrawable.Draw怎么用?C# IDrawable.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDrawable的用法示例。


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

示例1: Draw

 /// <summary>
 /// Draws out the particle with the given drawable at the
 /// particle's position.
 /// </summary>
 public void Draw(IDrawable drawable, DrawingArgs args)
 {
     double ratio = secondsRemaining / Constants.MaxSwarmParticleLife;
     Color c = Color.FromArgb((int) (ratio * 255.0), Color.White);
     PointF p = new PointF(CurrentX, CurrentY);
     drawable.Draw(p, c, args.BackendDrawingArgs);
 }
开发者ID:dmoonfire,项目名称:cutegod,代码行数:11,代码来源:SwarmParticle.cs

示例2: Clock

        public Clock()
        {
            InitializeComponent();
            InitializeMenu();
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);

            _mathService = new MathService(ClientRectangle);
            _background = new Background(Properties.Settings.Default.backgroundColor);
            _hands = new Hands(_mathService, new DateTimeService(), Properties.Settings.Default.handColor);
            _numerals = new Numerals(_mathService, Properties.Settings.Default.foreColor);
            _ticks = new Tick(_mathService, Properties.Settings.Default.tickColor);
            _center = new Center(_mathService, Properties.Settings.Default.handColor);
            _resizeGrip = new ResizeGrip(_mathService);

            if (!Properties.Settings.Default.lastWindowSize.IsEmpty)
            {
                Size = Properties.Settings.Default.lastWindowSize;
            }

            if (!Properties.Settings.Default.lastWindowLocation.IsEmpty)
            {
                Location = Properties.Settings.Default.lastWindowLocation;
            }

            MouseDown += (object o, MouseEventArgs e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    Win32.NativeMethods.ReleaseCapture();
                    Win32.NativeMethods.SendMessage(Handle, Win32.Constants.WM_NCLBUTTONDOWN, Win32.Constants.HTCAPTION, 0);
                }
            };

            ResizeBegin += (o, e) => { _timer.Stop(); };
            ResizeEnd += (o, e) => { _timer.Start(); };
            Resize += (o, e) => { _mathService.Rectangle = ClientRectangle; };

            Properties.Settings.Default.PropertyChanged += (o, e) =>
            {
                _hands.Color = Properties.Settings.Default.handColor;
                _numerals.Color = Properties.Settings.Default.foreColor;
                _ticks.Color = Properties.Settings.Default.tickColor;
                _background.Color = Properties.Settings.Default.backgroundColor;
                _center.Color = Properties.Settings.Default.handColor;
                _resizeGrip.Color = Properties.Settings.Default.backgroundColor;
                Invalidate();
            };

            Paint += (object o, PaintEventArgs e) =>
            {
                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                _graphicsService.Graphics = e.Graphics;
                _background.Draw(_graphicsService);
                _hands.Draw(_graphicsService);
                _numerals.Draw(_graphicsService);
                _ticks.Draw(_graphicsService);
                _center.Draw(_graphicsService);
                _resizeGrip.Draw(_graphicsService);
            };

            FormClosing += (o, e) =>
            {
                Properties.Settings.Default.lastWindowLocation = Location;
                Properties.Settings.Default.lastWindowSize = Size;
                Properties.Settings.Default.Save();
            };

            OnResize(EventArgs.Empty);

            _timer = new Timer();
            _timer.Interval = 1000;
            _timer.Tick += (o, e) => { Invalidate(); };
            _timer.Start();
        }
开发者ID:tswaters,项目名称:clocker,代码行数:74,代码来源:Clock.cs

示例3: CreateImage

        // TODO: We need a parameter here because not all the views are games
        // we need to extend the concept of view to include Widgets
        public bool CreateImage(IDrawable drawable, string file)
        {
            Cairo.ImageSurface cairo_image = null;
            gbrainy.Core.Main.CairoContextEx cr = null;

            try
            {
                file = Path.GetFullPath (file);
                cairo_image = new Cairo.ImageSurface (Cairo.Format.ARGB32, IMAGE_WIDTH, IMAGE_HEIGHT);
                cr = new gbrainy.Core.Main.CairoContextEx (cairo_image, "sans 12", 96);

                // Draw Image
                drawable.Draw (cr, IMAGE_WIDTH, IMAGE_WIDTH, false);
                cairo_image.WriteToPng (file);

                if (File.Exists (file) == false)
                    Logger.Error ("Game.CreateImage. Error writting {0}", file);
                else
                    Logger.Debug ("Game.CreateImage. Wrote image {0}", file);
            }

            catch (Exception e)
            {
                Logger.Error ("Game.CreateImage. Error writting {0} {1}", file, e);
                return false;
            }

            finally
            {
                if (cr != null)
                    ((IDisposable) cr).Dispose ();

                if (cairo_image != null)
                    ((IDisposable) cairo_image).Dispose ();
            }

                return true;
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:40,代码来源:GameImage.cs

示例4: Draw

 public static void Draw(IDrawable obj, Object surface)
 {
     obj.Draw(surface);
 }
开发者ID:avmaxim,项目名称:K-means-Clustering,代码行数:4,代码来源:K_Painter.cs

示例5: Draw

 public void Draw(IDrawable renderable)
 {
     renderable.Draw(this);
 }
开发者ID:killowatt,项目名称:Dunamis,代码行数:4,代码来源:Renderer.cs

示例6: Draw

 public static void Draw(IDrawable obj)
 {
     obj.Draw();
 }
开发者ID:avmaxim,项目名称:K-means-Clustering,代码行数:4,代码来源:MM_Painter.cs


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