Example E3912
Visible to All Users

WinForms Document Manager - Create a control-based document

This example shows how to add a WinForms Rich Text Editor to the DocumentManager as a document. The example creates a new RichEditControl and docks it as a tab each time the Add Tabbed Document button is clicked.

The Remove All button closes all documents within the view.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

DcoumentManagerContentGenerator/Form1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraBars; using DevExpress.XtraRichEdit; using DevExpress.XtraBars.Docking2010.Views.Tabbed; using DevExpress.XtraBars.Docking2010.Views.NativeMdi; using DevExpress.XtraBars.Docking2010.Views; namespace DcoumentManagerContentGenerator { public partial class Form1 : Form { int index = 1; public Form1() { InitializeComponent(); documentManager2.View.DocumentProperties.UseFormIconAsDocumentImage = false; documentManager2.View.UseDocumentSelector = DevExpress.Utils.DefaultBoolean.True; tabbedView1.FloatingDocumentContainer = FloatingDocumentContainer.DocumentsHost; } void AddNewTextDoc(string s, bool tabbed) { RichEditControl newTB = new RichEditControl(); newTB.Size = new Size(400, 170); newTB.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; newTB.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.PrintLayout; newTB.Views.PrintLayoutView.ZoomFactor = 0.7f; newTB.Name = s + index.ToString(); newTB.Text = s + " " + index.ToString(); documentManager2.View.BeginUpdate(); if (tabbed == true) { documentManager2.View.AddDocument(newTB); } else documentManager2.View.AddFloatDocument(newTB); documentManager2.View.EndUpdate(); index++; } private void addTabbedDoc(object sender, ItemClickEventArgs e) { AddNewTextDoc("Document", true); } private void addFloatDoc(object sender, ItemClickEventArgs e) { AddNewTextDoc("Document", false); } private void closeAllDocs(object sender, ItemClickEventArgs e) { documentManager2.View.Controller.CloseAll(); index = 1; } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.