814344 BUG: When setting the anchor property before setting the multiline property, Textbox does not resize (from mkba)

xiaoxiao2021-03-06  74

Symptoms set

After the anchor property,

TextBox control

Multiline property is set to

When True,

Textbox may not be adjusted to

Textbox

The size specified in the Size property. but,

Textbox allows you to enter multiple lines of text.

Alternative methods To correct this error, use one of the following methods:

After setting the multiline property, set the anchor property (as shown in the following code): Visual Basic .NET Code 'Setting Multiline Property

TXTBOX.MULTILINE = TRUE

'Setting Anchor Property

TXTBOX.ANCHOR = Anchorstyles.top or Anchorstyles.Bottom or Anchorstyles.left or Anchorstyles.right Visual C # .NET Code // Setting Multiline Property

TXTBOX.MULTILINE = TRUE;

// setting Anchor Property

TXTBOX.ANCHOR = Anchorstyles.top | Anchorstyles.Bottom | Anchorstyles.right | After setting up the multiline property, set the "textbox" size property (as shown in the following code): Visual Basic .NET Code 'Setting Anchor Property

TXTBOX.ANCHOR = Anchorstyles.top or Anchorstyles.bottom or Anchorstyles.right OR Anchorstyles.right

'Setting Multiline Property

TXTBOX.MULTILINE = TRUE

'Setting the size of the textbox

TXTBOX.SIZE = New System.drawing.size (100, 100) Visual C # .NET Code / / SETTING ANCHOR Property

TXTBOX.ANCHOR = Anchorstyles.top | Anchorstyles.Bottom | Anchorstyles.Light | Anchorstyles.right;

// setting Multiline Property

TXTBOX.MULTILINE = TRUE;

// setting the size of the textbox

TXTBOX.SIZE = New System.drawing.size (100, 100);

Status Microsoft has confirmed this a vulnerability in Microsoft products listed in this article.

More information

Steps to reproduce problems

Start Microsoft Visual Studio .NET (2003). On the File menu, point to "New" and click Project. In Project Type, click the "Visual C # .NET" item or "Visual Basic .NET" project. In Template, click the "Windows Application". Name the project MultilineApplication, and then click OK. Replace the existing code to: Visual Basic .NET Code Option Strict on

Imports System.Windows.Forms

Imports System.drawingImports System.drawingImports System.drawingImports System.drawingImports System.draw

Class MultiLineTextBoxform: Inherits Form

'Constructor

Sub new ()

DIM TXTBOX As TextBox = new system.windows.Forms.TextBox

TXTBOX.Visible = TRUE

TXTBOX.LOCATION = New System.drawing.Point (8, 8)

TXTBOX.SIZE = New System.drawing.size (100, 100)

TXTBOX.NAME = "MultilinetextBox"

'With this Order the textbox may be resize

TXTBOX.ANCHOR = Anchorstyles.top or Anchorstyles.bottom or Anchorstyles.right OR Anchorstyles.right

TXTBOX.MULTILINE = TRUE

Clientsize = new system.drawing.size (176, 176)

Controls.add (txtbox)

End Sub

Shang Sub Main ()

Application.run (New MultilinetextBoxForm)

End Sub

END CLASS

Visual C # .NET Code Using System.windows.Forms;

Using system.drawing;

Using system;

Namespace MultilineApplication

{

Public Class MultiLineTextBoxForm: Form

{

// conncture

Public multilinetextBoxForm ()

{

TextBox txtbox = new system.windows.forms.textbox ();

TXTBOX.VISIBLE = TRUE;

TXTBOX.LOCATION = New System.drawing.Point (8, 8);

TXTBOX.SIZE = New System.drawing.size (100, 100);

TXTBOX.NAME = "TXT";

// with this Order the textbox may be resize;

TXTBOX.ANCHOR = Anchorstyles.top | Anchorstyles.Bottom | Anchorstyles.Light | Anchorstyles.right;

TXTBOX.MULTILINE = TRUE;

Clientsize = new system.drawing.size (176, 176);

Controls.add (txtbox);

}

// main Method

Static void main (string [] args)

{

Application.run (New multilinetextboxform ());

}

}

} On the Debug menu, click Start. At this point, there will be a problem discussed in the "Symptoms" section of this article.

The information in this article applies to:

Microsoft Visual Studio .NET (2003), Enterprise Developer Edition Microsoft Visual Studio .NET (2003), Enterprise Architect Edition Microsoft Visual Studio .NET (2003), Professional Edition Microsoft Visual Studio .NET (2003), Academic Edition Microsoft Visual Studio. Net (2003), Trial Edition recently updated: 2003-10-24 (1.2) Keywords: kbuidesign kbwindowsforms KBLAYOUGN KBFORMS KBPROPERTIES KBBUG KB814344 KBAUDDEVELOPER

转载请注明原文地址:https://www.9cbs.com/read-108951.html

New Post(0)