private void RemoveTextbox() { if (null != Site && null != _textBox) { MESDesignerService ms = Site. GetService(typeof(MESDesignerService)) as MESDesignerService; if (null != ms) { ms.RemoveControl(_textBox); } } }
public void BeginEdit() { if (null == _textBox) { _selectionService = Site.GetService(typeof(ISelectionService)) as ISelectionService; if (null == _selectHandler) { _selectHandler = new EventHandler(SelectionService_SelectionChanged); } if (null != _selectionService) { _selectionService.SelectionChanged += _selectHandler; } _textBox = new TextBox(); _textBox.Width = Width; _textBox.Height = Height; _textBox.Multiline = true; if (BackColor != Color.Transparent) { _textBox.BackColor = BackColor; } if (ForeColor != Color.Transparent) { _textBox.ForeColor = ForeColor; } _textBox.Font = Font.Clone() as Font; _textBox.TextAlign = TransformTextAlign(); _textBox.Location = new Point(0, 0); _textBox.KeyDown += TextBox_KeyDown; _textBox.Text = Text; MESDesignerService ms = Site. GetService(typeof(MESDesignerService)) as MESDesignerService; if (null != ms) { ms.CreateControl(_textBox); } IsEdit = true; } }