$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
RichTextBox Control for Windows Forms
Edit rich text content with text formatting options, mail-merge, table, and floating objects, etc.
Home > WinForms UI Controls > User Manual > RichTextBox Inline Image in C#

InlineImage of KetticDocument in RichTextBox in C#.NET

KetticRichTextBox control provides the inline element, InlineImage, for the users to insert and display images in the document. The InlineImage C# class can only be used in the context of a paragraph. This element is placed after the previous inline element until the end of the lines and will wrap the line as there is insufficient space. In this C# tutorial, we will work through the process of using the InlineImage element.

C# Add InlineImage Element to Document

The C# code snippet below demonstrates how to add an InlineImage element to document.

Section section = new Section();
Paragraph paragraph = new Paragraph();
Size size = new Size(236, 50);
ImageInline image = new ImageInline(Resources.Desert, size);

C# Add InlineImage Element through UI

KetticRichTextBox control allows the users to add InlineImage element using C# code via user interface of the control. To achieve this, we can follow the steps as below.
  1. Apply the KetticButton and click the OpenFileDialog
  2. When the OpenFileDialog open, get the file path and create a new Bitmap with the path to the image
  3. Pass the image to the InsertImage() method of the KetticRichTextBox
  4. The image will show in the document when calling the InsertImage() method
The C# code below shows how to add image to document via the UI.

private void imageButton_Click(object sender, EventArgs e)
OpenFileDialog openDialog = new OpenFileDialog();
openDialog.Filter = "Images|*.png";
openDialog.Multiselect = false;
if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
Bitmap img = new Bitmap(openDialog.FileName);

UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls