Ejemplo n.º 1
0
 void gif_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Clicks == 2 && e.Button == MouseButtons.Left)
     {
         GifBox         gif = (GifBox)sender;
         FrmPrintscreen frm = new FrmPrintscreen(gif.Image);
         frm.Show(this);
     }
 }
Ejemplo n.º 2
0
 private void btnAddImg_Click(object sender, EventArgs e)
 {
     if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Image  img = Image.FromFile(open.FileName);
         GifBox gif = txtSend.InsertImage((Image)img.Clone());
         gif.MouseDown += gif_MouseDown;
         img.Dispose();
     }
 }
Ejemplo n.º 3
0
        private void FrmChat_Load(object sender, EventArgs e)
        {
            Image  img = Image.FromFile(Application.StartupPath + "//1.png");
            GifBox gif = txtSend.InsertImage((Image)img.Clone());

            gif.MouseDown += gif_MouseDown;
            img.Dispose();
            this.txtSend.DragDrop  += new DragEventHandler(txtSend_DragDrop);
            this.txtSend.DragEnter += new DragEventHandler(txtSend_DragEnter);
        }
Ejemplo n.º 4
0
        private void AddLoadingGif()
        {
            gifBox        = new GifBox();
            gifBox.Image  = Properties.Resources.bycleLoad;
            gifBox.Width  = gifBox.Image.Width;
            gifBox.Height = gifBox.Image.Height;
            int x = (this.Width - gifBox.Image.Width) / 2;
            int y = (this.Height - gifBox.Image.Height) / 2;

            gifBox.Location = new Point(x, y);
            this.Controls.Add(gifBox);
        }
Ejemplo n.º 5
0
        private void AddLoadingGif()
        {
            if (gifBox == null)
            {
                gifBox = new GifBox();
            }

            gifBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            gifBox.Image  = Properties.Resources.bycleLoad;
            gifBox.Width  = gifBox.Image.Width;
            gifBox.Height = gifBox.Image.Height;
            int x = (this.Width - gifBox.Width) / 2;
            int y = (this.Height - gifBox.Height) / 2;

            gifBox.Location = new Point(x, y);
            this.Controls.Add(gifBox);
        }
Ejemplo n.º 6
0
        //截图方法
        private void StartCapture()
        {
            FrmCapture imageCapturer = new FrmCapture();

            if (imageCapturer.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Forms.IDataObject iData = Clipboard.GetDataObject();
                if (iData.GetDataPresent(DataFormats.Bitmap))  //如果剪贴板中的数据是文本格式
                {
                    GifBox gif = this.chatBoxSend.InsertImage((Bitmap)iData.GetData(DataFormats.Bitmap));
                    this.chatBoxSend.Focus();
                    this.chatBoxSend.ScrollToCaret();
                    imageCapturer.Close();
                    imageCapturer = null;
                }
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 在position位置处,插入图片。
 /// </summary>   
 /// <param name="image">要插入的图片</param>
 /// <param name="position">插入的位置</param>       
 public void InsertImage(Image image, int position)
 {
     try
     {
         GifBox gif = new GifBox();
         gif.Cursor = Cursors.Hand;
         gif.BackColor = base.BackColor;
         gif.Size = this.ComputeGifBoxSize(image.Size);
         gif.Image = image;
         this.RichEditOle.InsertControl(gif, position, 10000);
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 在position位置处,插入系统内置表情。
 /// </summary>      
 /// <param name="position">插入的位置</param>
 /// <param name="emotionID">表情图片在内置列表中的index</param>
 public void InsertDefaultEmotion(uint emotionID, int position)
 {
     try
     {
         Image image = this.pictureBox1.ErrorImage;
         if (this.defaultEmotionDictionary.ContainsKey(emotionID))
         {
             image = this.defaultEmotionDictionary[emotionID];
         }
         GifBox gif = new GifBox();
         gif.Cursor = Cursors.Hand;
         gif.BackColor = base.BackColor;
         gif.Size = this.ComputeGifBoxSize(image.Size);
         gif.Image = image;
         this.RichEditOle.InsertControl(gif, position, emotionID);
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }