Esempio n. 1
0
 /// <summary>
 /// In-place Edit.
 /// </summary>
 public void EnterInplaceEditMode(object sender, InPlaceEditEventArgs e)
 {
     //a redundant check
     if (e.EditControl is TextBox)
     {
         editing = true;
         editControl = e.EditControl;
         TextBox editBox = (TextBox)e.EditControl;
         //remove the border from the textbox
         editBox.BorderStyle = BorderStyle.None;
         //make sure we are editing a note
         if (e.Node is ShapeNode)
         {
             ShapeNode note = (ShapeNode)e.Node;
             //set the edit box text alignment
             if (note.TextFormat.Alignment == StringAlignment.Center)
             {
                 editBox.TextAlign = HorizontalAlignment.Center;
             }
             else if (note.TextFormat.Alignment == StringAlignment.Far)
             {
                 editBox.TextAlign = HorizontalAlignment.Right;
             }
             else if (note.TextFormat.Alignment == StringAlignment.Near)
             {
                 editBox.TextAlign = HorizontalAlignment.Left;
             }
             //set the edit box font size
             float zoom = diagramView1.ZoomFactor / 100;
             System.Drawing.Font font = new Font(note.Font.FontFamily, note.Font.Size * zoom);
             editBox.Font = font;
             editBox.BorderStyle = BorderStyle.FixedSingle;
         }
     }
 }
Esempio n. 2
0
 private void LeaveInplaceEditMode(object sender, InPlaceEditEventArgs e)
 {
     editing = false;
     editControl = null;
 }