winform下一个编辑框
1,实现gif动画显示 类似qq 输入框(目前用的 能显示jpg,gif显示的是第一帧的richtextbox)
2,有没有牛叉(高效率)的代码高亮的 编辑框,最好是继承自richtextbox(现在着色用的 select ,那个效率啊!)
3,想要个 把 1,2功能 给 和起来 控件 过几天还会散分的

解决方案 »

  1.   

    IMlibrary 里面有个RichTextBoxEx 符合要求
      

  2.   

    这里有一个能添加控件的RichTextBox,但是添加gif图像不会动画,不过把Gif动画包在PictureBox里会动的,然后把PictureBox插入到这个RichTextBox里?你可以试试参考资料
    http://www.codeproject.com/KB/edit/MyExtRichTextBox.aspxhttp://stackoverflow.com/questions/165735/how-do-you-show-animated-gifs-on-a-windows-form-c
      

  3.   

    如果我数据量大,图片用pic 不行的,能加入richtextbox 但是
    位置不好确定
    而且不像是 嵌在文本里面
      

  4.   

    上面的那个方法我刚试了即使将gif嵌套在PictureBox里,再插入到RichTextBox中,动画也不会进行!!!只能用自己写控件继承Control,用原始的ImageAnimator类来逐帧更新了。using System;
    using System.Windows.Forms;
    using System.Drawing;namespace WindowsFormsApplication1
    {
        class MyGifBox : Control
        {
            Image img;
            string path;
            public string Path
            {
                get { return path; }
                set { path = value; UpdatePath(); }
            }        public MyGifBox() : base() { }
            public MyGifBox(string src)
                : base()
            {
                Path = src;
            }        void UpdatePath()
            {
                img = Bitmap.FromFile(path);
                if (img != null)
                {
                    this.Width = img.Width;
                    this.Height = img.Height;
                }
            }        bool currentlyAnimating = false;        public void AnimateImage()
            {
                if (!currentlyAnimating)
                {
                    ImageAnimator.Animate(img, new EventHandler(this.OnFrameChanged));
                    currentlyAnimating = true;
                }
            }        private void OnFrameChanged(object o, EventArgs e)
            {
                Invalidate();
            }        protected override void OnPaint(PaintEventArgs e)
            {
                if (img == null)
                    return;
                AnimateImage();
                ImageAnimator.UpdateFrames();
                e.Graphics.DrawImage(img, new Point(0, 0));
            }
        }
    }接下来把这个控件插入到刚才那个扩展的RichTextBox中,如下        private void Form1_Shown(object sender, EventArgs e)
            {
                for (int i = 0; i < 10; i++)
                    myExtRichTextBox1.InsertControl(new MyGifBox(@"E:\My Documents\My Pictures\39.gif"));
            }
    大功告成!当然期待高人们想一些更好的方法!我感觉我这个方法效率上不怎么高,欠缺很多优化。
      

  5.   

    myExtRichTextBox1 是MyExtRichTextBox类对象,这个类在这下载:http://www.codeproject.com/KB/edit/MyExtRichTextBox.aspx下载需要CodeProject账号 >_<