Exemplo n.º 1
0
        /// <summary>
        /// ����ͼƬ
        /// </summary>
        /// <param name="image">gifͼƬ·��</param>
        /// <param name="position">�</param>
        /// <returns>GifBox����ؼ�</returns>
        public GifBox InsertImage(Image image, int?position = null)
        {
            if (position == null)
            {
                position = this.SelectionStart;
            }
            GifBox control = new GifBox {
                BackColor = base.BackColor,
                Image     = image
            };

            this.RichEditOle.InsertControl(control, Convert.ToInt32(position), 0);
            return(control);
        }
Exemplo n.º 2
0
        /// <summary>
        /// ���ݱ�Ų���ͼƬ
        /// </summary>
        /// <param name="imageID">���</param>
        /// <param name="position">�</param>
        /// <returns>GifBox����ؼ�</returns>
        public GifBox InsertImage(uint imageID, int?position = null)
        {
            if (position == null)
            {
                position = this.SelectionStart;
            }
            if (imageID <= 0)
            {
                throw new Exception("imageID must greater than 0.");
            }
            GifBox control = new GifBox {
                BackColor = base.BackColor,
                Image     = Image.FromFile(this.imagePathGetter.GetPath(imageID))
            };

            this.RichEditOle.InsertControl(control, Convert.ToInt32(position), imageID);
            return(control);
        }