> For the complete documentation index, see [llms.txt](https://docs.wisej.com/system.drawing.managed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md).

# StringFormat

Namespace: **System.Drawing**

Assembly: **System.Drawing.Managed** (4.0.0.0)

Encapsulates text layout information (such as alignment, orientation and tab stops), display manipulations (such as ellipsis insertion and national digit substitution) and OpenType features. This class cannot be inherited.

{% tabs %}
{% tab title="C#" %}

```csharp
public class StringFormat : MarshalByRefObject, ICloneable, IDisposable
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class StringFormat
    Inherits MarshalByRefObject
    Implements ICloneable, IDisposable
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/gN3G3VR5GgQngV3jdnfJ) StringFormat()

Initializes a new instance of the [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) class.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) StringFormat(options)

Initializes a new instance of the [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) class.

| Name        | Type                                                                                                | Description                                                                                                                                          |
| ----------- | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **options** | [StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md) | The [StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md) enumeration for the new StringFormat object. |

### ![](/files/gN3G3VR5GgQngV3jdnfJ) StringFormat(options, language)

Initializes a new instance of the [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) class.

| Name         | Type                                                                                                | Description                                                                                                                                          |
| ------------ | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **options**  | [StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md) | The [StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md) enumeration for the new StringFormat object. |
| **language** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                         | A value that indicates the language of the text.                                                                                                     |

### ![](/files/gN3G3VR5GgQngV3jdnfJ) StringFormat(format)

Initializes a new instance of the [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) class.

| Name       | Type                                                                                      | Description                                                                                                                                                                                                                             |
| ---------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format** | [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) | The [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object from which to initialize the new [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object. |

## Properties

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Alignment

[StringAlignment](/system.drawing.managed/api/system.drawing/system.drawing.stringalignment.md): Gets or sets horizontal alignment of the string.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) FormatFlags

[StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md): Gets or sets a [StringFormatFlags](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md) enumeration that contains formatting information.

### ![](/files/eguYxwyd6jAtQFHRrmJW) GenericDefault

[StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md): Gets a generic default [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md). A generic, default [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object has the following characteristics:

* No string format flags are set.
* Character alignment and line alignment are set to [Near](/system.drawing.managed/api/system.drawing/system.drawing.stringalignment.md#fields).
* Language ID is set to neutral language, which means that the current language associated with the calling thread is used.
* Hot key prefix is set to [None](/system.drawing.managed/api/system.drawing.text/system.drawing.text.hotkeyprefix.md#fields).
* String trimming is set to [Character](/system.drawing.managed/api/system.drawing/system.drawing.stringtrimming.md#fields).

### ![](/files/eguYxwyd6jAtQFHRrmJW) GenericTypographic

[StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md): Gets a generic typographic [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md). A generic, typographic [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object has the following characteristics:

* Format flags are set to [NoClip](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md#fields), [FitBlackBox](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md#fields) and [LineLimit](/system.drawing.managed/api/system.drawing/system.drawing.stringformatflags.md#fields).
* Character alignment and line alignment are set to [Near](/system.drawing.managed/api/system.drawing/system.drawing.stringalignment.md#fields).
* Language ID is set to neutral language, which means that the current language associated with the calling thread is used.
* Hot key prefix is set to [None](/system.drawing.managed/api/system.drawing.text/system.drawing.text.hotkeyprefix.md#fields).
* String trimming is set to [Character](/system.drawing.managed/api/system.drawing/system.drawing.stringtrimming.md#fields).

### ![](/files/gN3G3VR5GgQngV3jdnfJ) HotkeyPrefix

[HotkeyPrefix](/system.drawing.managed/api/system.drawing.text/system.drawing.text.hotkeyprefix.md): Gets or sets the [HotkeyPrefix](#hotkeyprefix) object for this [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) LineAlignment

[StringAlignment](/system.drawing.managed/api/system.drawing/system.drawing.stringalignment.md): Gets or sets the vertical alignment of the string.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Trimming

[StringTrimming](/system.drawing.managed/api/system.drawing/system.drawing.stringtrimming.md): Gets or sets the StringTrimming enumeration for this [StringFormat](/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md) object.

## Methods

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Clone()

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object).

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Dispose()


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/system.drawing.managed/api/system.drawing/system.drawing.stringformat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
