Exemplo n.º 1
0
 /// <summary>
 /// Creates peer of comments
 /// </summary>
 /// <param name="control">Parent control</param>
 /// <param name="comments">Comments</param>
 public static void CreatePeer(Control control, ICollection comments)
 {
     foreach (object o in comments)
     {
         if (o is MovedTextBox)
         {
             MovedTextBox tb = o as MovedTextBox;
             Label        l  = new Label();
             l.BackColor = Color.White;
             l.Left      = tb.Left;
             l.Top       = tb.Top;
             l.Width     = tb.Width;
             l.Height    = tb.Height;
             l.Font      = tb.Font;
             l.Text      = tb.Text;
             control.Controls.Add(l);
             continue;
         }
         MovedPictureBox mpb = o as MovedPictureBox;
         PictureBox      p   = new PictureBox();
         p.Left   = mpb.Left;
         p.Top    = mpb.Top;
         p.Width  = mpb.Width;
         p.Height = mpb.Height;
         p.Image  = mpb.Image;
         control.Controls.Add(p);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Clones itself
        /// </summary>
        /// <returns>The clone</returns>
        public object Clone()
        {
            MovedTextBox clone = new MovedTextBox();

            clone.Left   = Left;
            clone.Top    = Top;
            clone.Width  = Width;
            clone.Height = Height;
            string s = "";

            foreach (char c in Text)
            {
                s += c;
            }
            clone.Text = s;
            Font      font = this.Font;
            FontStyle fs   = 0;

            if (font.Bold)
            {
                fs |= FontStyle.Bold;
            }
            else
            {
                fs |= FontStyle.Regular;
            }
            if (font.Italic)
            {
                fs |= FontStyle.Italic;
            }
            if (font.Underline)
            {
                fs |= FontStyle.Underline;
            }
            if (font.Strikeout)
            {
                fs |= FontStyle.Strikeout;
            }
            clone.Font        = new Font(font.Name, font.SizeInPoints, fs, GraphicsUnit.Point);
            clone.BorderStyle = BorderStyle.None;
            return(clone);
        }
Exemplo n.º 3
0
        private void dragDrop(object sender, DragEventArgs e)
        {
            if (!e.Data.GetDataPresent("Text"))
            {
                return;
            }
            string str = e.Data.GetData("Text") as string;

            if (!str.Equals("MovedEditor"))
            {
                return;
            }
            TextBox tf = new MovedTextBox();
            int     x = 0, y = 0;

            FormTools.GetCoordinates(control, ref x, ref y);
            tf.Left = e.X - x;
            tf.Top  = e.Y - y;
            control.Controls.Add(tf);
        }