예제 #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (var dlg = new TextDialog())
     {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             var pos = _layout.CreateTextPosition(dlg.PositionLeft, dlg.PositionBottom, dlg.PositionUnits);
             var fnt = _layout.CreateFont(dlg.FontName, dlg.FontHeight, dlg.FontUnits);
             var txt = _layout.CreateText(dlg.TextString, fnt, pos);
             _texts.Add(txt);
         }
     }
 }
예제 #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     var txt = lstCustomText.SelectedItem as IText;
     if (txt != null)
     {
         using (var dlg = new TextDialog())
         {
             dlg.TextString = txt.Value;
             dlg.FontUnits = txt.Font.Units;
             dlg.FontName = txt.Font.Name;
             dlg.FontHeight = txt.Font.Height;
             dlg.PositionBottom = txt.Position.Bottom;
             dlg.PositionLeft = txt.Position.Left;
             dlg.PositionUnits = txt.Position.Units;
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 txt.Value = dlg.TextString;
                 txt.Font.Units = dlg.FontUnits;
                 txt.Font.Name = dlg.FontName;
                 txt.Font.Height = dlg.FontHeight;
                 txt.Position.Bottom = dlg.PositionBottom;
                 txt.Position.Left = dlg.PositionLeft;
                 txt.Position.Units = dlg.PositionUnits;
                 OnResourceChanged();
             }
         }
     }
 }