Share via


Word.Box Property

 

Deprecated. The Box property returns a Windows.Foundation.Rect object that defines a box around the current Word. The dimensions of the box are returned to The Bing Optical Character Recognition (OCR) Control by the Bing OCR Service.

Published date: March 4, 2014

Warning

The Bing OCR Control is deprecated as of March 12, 2014

Syntax

public Windows.Foundation.Rect Box { get; }

Property Value

Type: Windows.Foundation.Rect

A Windows.Foundation.Rect object that defines a box around the current Word.

Example

The following example renders the contents of a Word object inside a TextBlock. The TextBlock is then placed inside a Grid object named Results. The scale variable is obtained by comparing the size of Results with the size of the captured image.

private void renderWord(Word word, double scale)
{
    var t = new TextBlock();
    var b = word.Box;

    // Draw the box.
    t.Height = b.Height * scale;
    t.Width = b.Width * scale;
    t.HorizontalAlignment = HorizontalAlignment.Left;
    t.VerticalAlignment = VerticalAlignment.Top;
    t.Margin = new Thickness(b.Left * scale, b.Top * scale, 0, 0);

    // Apply the text.
    t.Text = word.Value;
    t.FontSize = t.Height * 0.9;

    // Put the filled box in the results grid.
    Results.Children.Add(t);
}

For the complete example, see How to: Extract text position data from an OCR result.

Requirements

Minimum Supported Client

Windows 8.1

Required Extensions

Bing OCR

Namespace

Bing.Ocr