예제 #1
0
파일: TextArea.cs 프로젝트: leonchen09/poc
        /// <summary>
        /// Attach the control to a specified document's control collection using a specified process.
        /// </summary>
        /// <param name="collection">The control collection to hold the control.</param>
        /// <param name="range">The location of the control.</param>
        /// <param name="width">The width of the control.</param>
        /// <param name="height">The height of the control.</param>
        /// <param name="shape">The control's inline shape object in the document</param>
        /// <returns>The component of the attached control.</returns>
        protected override Control Attach(ControlCollection collection, Word.Range range, float width, float height, out Word.InlineShape shape)
        {
            //adds a rich text box control to the document
            var control = collection.AddRichTextBox(range, width, height, ObjectId);

            //initialize control properties
            control.ReadOnly  = true;
            control.BackColor = Color.White;

            shape = control.InlineShape;

            return(control);
        }