• GMap.NET 显示GIF图标的定制


    利用System.Drawing.ImageAnimator类实现GIF图标显示

    public class GMapMarkerImage : GMapMarker
    {
        private Image image;
        private bool currentlyAnimating;
    
        public GMapMarkerImage(PointLatLng pos, Image image) : base(pos)
        {
            Size = new Size(image.Width, image.Height);
            Offset = new Point(-Size.Width / 2, -Size.Height / 2);
            this.image = image;
        }
    
        protected GMapMarkerImage(SerializationInfo info, StreamingContext context) : base(info, context)
        {
        }
        private bool isAnimateImage()
        {
            if (image == null)
                return false;
            return ImageAnimator.CanAnimate(image);
        }
        public void AnimateImage()
        {
            if (!currentlyAnimating)
            {
                ImageAnimator.Animate(image, new EventHandler(this.OnFrameChanged));
                currentlyAnimating = true;
            }
        }
    
        private void OnFrameChanged(object sender, EventArgs e)
        {
            
        }
    
        public override void OnRender(Graphics g)
        {
            if (image == null)
            {
                return;
            }
            if (isAnimateImage())
            {
                AnimateImage();
                //更新到下一帧
                ImageAnimator.UpdateFrames();
            }
             rect = new Rectangle(LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height);
            g.DrawImage(image, rect);
        }
    }

    定时器设置为300毫秒

    private void timer1_Tick(object sender, EventArgs e)
    {
        _mmapControl.Refresh();
    }
  • 相关阅读:
    socket注意
    PCM音频文件编码
    题外:分类篇(音乐风格分类)基于BP神经网络
    MFCC特征提取过程详解
    语音信号分析
    k-means聚类
    c++关键字详解
    vs中项目解决方案和项目的关系
    条件编译#ifdef 和#endif
    c++快捷键
  • 原文地址:https://www.cnblogs.com/joe62/p/6882229.html
Copyright © 2020-2023  润新知