401 references to HorizontalAlignment
System.Windows.Forms (92)
System\Windows\Forms\Control.cs (8)
10483protected HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) 10501protected HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) 10505if (align == HorizontalAlignment.Left) 10507return HorizontalAlignment.Right; 10509else if (align == HorizontalAlignment.Right) 10511return HorizontalAlignment.Left;
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxEditingControl.cs (4)
302private static HorizontalAlignment TranslateAlignment(DataGridViewContentAlignment align) 306return HorizontalAlignment.Right; 310return HorizontalAlignment.Center; 314return HorizontalAlignment.Left;
System\Windows\Forms\Controls\ListView\ColumnHeader.cs (7)
29private HorizontalAlignment _textAlign = HorizontalAlignment.Left; 326[DefaultValue(HorizontalAlignment.Left)] 327public HorizontalAlignment TextAlign 338_textAlign = HorizontalAlignment.Right; 352if (Index == 0 && _textAlign != HorizontalAlignment.Left) 354_textAlign = HorizontalAlignment.Left;
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (4)
127HorizontalAlignment hAlign = Header?.TextAlign ?? HorizontalAlignment.Left; 128TextFormatFlags flags = (hAlign == HorizontalAlignment.Left) ? TextFormatFlags.Left : 129((hAlign == HorizontalAlignment.Center) ? TextFormatFlags.HorizontalCenter :
System\Windows\Forms\Controls\ListView\DrawListViewSubItemEventArgs.cs (4)
123HorizontalAlignment hAlign = Header?.TextAlign ?? HorizontalAlignment.Left; 124TextFormatFlags flags = (hAlign == HorizontalAlignment.Left) ? TextFormatFlags.Left : 125((hAlign == HorizontalAlignment.Center) ? TextFormatFlags.HorizontalCenter :
System\Windows\Forms\Controls\ListView\ListView.ColumnHeaderCollection.cs (6)
173public virtual ColumnHeader Add(string? text, int width, HorizontalAlignment textAlign) 233public virtual ColumnHeader Add(string? key, string? text, int width, HorizontalAlignment textAlign, string imageKey) 245public virtual ColumnHeader Add(string? key, string? text, int width, HorizontalAlignment textAlign, int imageIndex) 416public void Insert(int index, string? text, int width, HorizontalAlignment textAlign) 469public void Insert(int index, string? key, string? text, int width, HorizontalAlignment textAlign, string imageKey) 481public void Insert(int index, string? key, string? text, int width, HorizontalAlignment textAlign, int imageIndex)
System\Windows\Forms\Controls\ListView\ListView.cs (6)
5723case HorizontalAlignment.Left: 5726case HorizontalAlignment.Right: 5729case HorizontalAlignment.Center: 5750case HorizontalAlignment.Left: 5753case HorizontalAlignment.Right: 5756case HorizontalAlignment.Center:
System\Windows\Forms\Controls\ListView\ListViewGroup.cs (14)
20private HorizontalAlignment _headerAlignment = HorizontalAlignment.Left; 22private HorizontalAlignment _footerAlignment = HorizontalAlignment.Left; 72public ListViewGroup(string? header, HorizontalAlignment headerAlignment) : this(header) 104[DefaultValue(HorizontalAlignment.Left)] 106public HorizontalAlignment HeaderAlignment 148/// One of the <see cref="HorizontalAlignment"/> values that specifies the alignment of the footer text. 149/// The default is <see cref="HorizontalAlignment.Left"/>. 152/// The specified value when setting this property is not a valid <see cref="HorizontalAlignment"/> value. 154[DefaultValue(HorizontalAlignment.Left)] 156public HorizontalAlignment FooterAlignment 355HeaderAlignment = (HorizontalAlignment)entry.Value!; 363FooterAlignment = (HorizontalAlignment)entry.Value!;
System\Windows\Forms\Controls\ListView\ListViewGroupConverter.cs (1)
95ConstructorInfo ctor = typeof(ListViewGroup).GetConstructor([typeof(string), typeof(HorizontalAlignment)])!;
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (10)
657[DefaultValue(HorizontalAlignment.Left)] 661public unsafe HorizontalAlignment SelectionAlignment 665HorizontalAlignment selectionAlignment = HorizontalAlignment.Left; 682selectionAlignment = HorizontalAlignment.Left; 686selectionAlignment = HorizontalAlignment.Right; 690selectionAlignment = HorizontalAlignment.Center; 711case HorizontalAlignment.Left: 715case HorizontalAlignment.Right: 719case HorizontalAlignment.Center:
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (7)
103private HorizontalAlignment _textAlign; 316HorizontalAlignment align = RtlTranslateHorizontal(_textAlign); 320case HorizontalAlignment.Left: 323case HorizontalAlignment.Center: 326case HorizontalAlignment.Right: 1238[DefaultValue(HorizontalAlignment.Left)] 1240public HorizontalAlignment TextAlign
System\Windows\Forms\Controls\TextBox\TextBox.cs (15)
50private HorizontalAlignment _textAlign = HorizontalAlignment.Left; 286HorizontalAlignment align = RtlTranslateHorizontal(_textAlign); 293case HorizontalAlignment.Left: 296case HorizontalAlignment.Center: 299case HorizontalAlignment.Right: 308&& _textAlign == HorizontalAlignment.Left 443[DefaultValue(HorizontalAlignment.Left)] 445public HorizontalAlignment TextAlign 876case HorizontalAlignment.Center: 880case HorizontalAlignment.Left: 884case HorizontalAlignment.Right: 895case HorizontalAlignment.Center: 899case HorizontalAlignment.Left: 903case HorizontalAlignment.Right:
System\Windows\Forms\Controls\ToolStrips\ToolStripTextBox.cs (2)
352[DefaultValue(HorizontalAlignment.Left)] 354public HorizontalAlignment TextBoxTextAlign
System\Windows\Forms\Controls\UpDown\UpDownBase.cs (2)
402[DefaultValue(HorizontalAlignment.Left)] 404public HorizontalAlignment TextAlign
System\Windows\Forms\Printing\PrintControllerWithStatusDialog.StatusDialog.cs (1)
43TextAlign = HorizontalAlignment.Center,
System\Windows\Forms\Printing\PrintPreviewDialog.cs (1)
899_pageCounter.TextAlign = HorizontalAlignment.Right;
System.Windows.Forms.Design (1)
System\ComponentModel\Design\DesignerActionPanel.TextBoxPropertyLine.cs (1)
50TextAlign = HorizontalAlignment.Left,
System.Windows.Forms.Tests (298)
MaskedTextBoxTests.cs (9)
41_maskedTextBox.TextAlign.Should().Be(HorizontalAlignment.Left); 656[InlineData(HorizontalAlignment.Left)] 657[InlineData(HorizontalAlignment.Center)] 658[InlineData(HorizontalAlignment.Right)] 659public void MaskedTextBox_TextAlign_Set_GetReturnsExpected(HorizontalAlignment alignment) 664HorizontalAlignment originalAlignment = control.TextAlign; 667HorizontalAlignment actualAlignment = control.TextAlign; 694control.TextAlign = HorizontalAlignment.Center; 698control.TextAlign = HorizontalAlignment.Right;
SerializableTypesTests.cs (2)
126ListViewGroup listViewGroup = new("Header", HorizontalAlignment.Center) 146Assert.Equal(HorizontalAlignment.Center, result.HeaderAlignment);
System\Windows\Forms\ColumnHeaderCollectionTests.cs (17)
197yield return new object[] { null, -1, HorizontalAlignment.Left, string.Empty }; 198yield return new object[] { string.Empty, 0, HorizontalAlignment.Center, string.Empty }; 199yield return new object[] { "text", 1, HorizontalAlignment.Right, "text" }; 204public void ColumnHeaderCollection_Add_String_Int_HorizontalAlignment_Success(string text, int width, HorizontalAlignment textAlign, string expectedText) 265yield return new object[] { null, null, -1, HorizontalAlignment.Left, -1, string.Empty, string.Empty }; 266yield return new object[] { string.Empty, string.Empty, 0, HorizontalAlignment.Center, 0, string.Empty, string.Empty }; 267yield return new object[] { "name", "text", 1, HorizontalAlignment.Right, 1, "name", "text" }; 272public void ColumnHeaderCollection_Add_String_String_Int_HorizontalAlignment_Int_Success(string name, string text, int width, HorizontalAlignment textAlign, int imageIndex, string expectedName, string expectedText) 290yield return new object[] { null, null, -1, HorizontalAlignment.Left, null, string.Empty, string.Empty, string.Empty }; 291yield return new object[] { string.Empty, string.Empty, 0, HorizontalAlignment.Center, string.Empty, string.Empty, string.Empty, string.Empty }; 292yield return new object[] { "name", "text", 1, HorizontalAlignment.Right, "imageKey", "name", "text", "imageKey" }; 297public void ColumnHeaderCollection_Add_String_String_Int_HorizontalAlignment_String_Success(string name, string text, int width, HorizontalAlignment textAlign, string imageKey, string expectedName, string expectedText, string expectedImageKey) 322[InvalidEnumData<HorizontalAlignment>] 323public void ColumnHeaderCollection_Add_InvalidTextAlign_ThrowsInvalidEnumArgumentException(HorizontalAlignment textAlign) 741public void ColumnHeaderCollection_Insert_String_Int_HorizontalAlignment_Success(string text, int width, HorizontalAlignment textAlign, string expectedText) 782public void ColumnHeaderCollection_Insert_String_String_Int_HorizontalAlignment_Int_Success(string name, string text, int width, HorizontalAlignment textAlign, int imageIndex, string expectedName, string expectedText) 798public void ColumnHeaderCollection_Insert_String_String_Int_HorizontalAlignment_String_Success(string name, string text, int width, HorizontalAlignment textAlign, string imageKey, string expectedName, string expectedText, string expectedImageKey)
System\Windows\Forms\ColumnHeaderTests.cs (58)
31Assert.Equal(HorizontalAlignment.Left, header.TextAlign); 57Assert.Equal(HorizontalAlignment.Left, header.TextAlign); 81Assert.Equal(HorizontalAlignment.Left, header.TextAlign); 1020[InlineData(RightToLeft.No, true, HorizontalAlignment.Left)] 1021[InlineData(RightToLeft.Yes, true, HorizontalAlignment.Left)] 1022[InlineData(RightToLeft.Inherit, true, HorizontalAlignment.Left)] 1023[InlineData(RightToLeft.No, false, HorizontalAlignment.Left)] 1024[InlineData(RightToLeft.Yes, false, HorizontalAlignment.Right)] 1025[InlineData(RightToLeft.Inherit, false, HorizontalAlignment.Left)] 1026public void ColumnHeader_TextAlign_GetWithListView_ReturnsExpected(RightToLeft rightToLeft, bool rightToLeftLayout, HorizontalAlignment expected) 1037Assert.Equal(HorizontalAlignment.Left, header1.TextAlign); 1041Assert.Equal(HorizontalAlignment.Left, header1.TextAlign); 1047Assert.Equal(HorizontalAlignment.Left, header1.TextAlign); 1106[EnumData<HorizontalAlignment>] 1107public void ColumnHeader_TextAlign_SetWithoutListView_GetReturnsExpected(HorizontalAlignment value) 1121[InlineData(0, HorizontalAlignment.Center, HorizontalAlignment.Left)] 1122[InlineData(0, HorizontalAlignment.Left, HorizontalAlignment.Left)] 1123[InlineData(0, HorizontalAlignment.Right, HorizontalAlignment.Left)] 1124[InlineData(1, HorizontalAlignment.Center, HorizontalAlignment.Center)] 1125[InlineData(1, HorizontalAlignment.Left, HorizontalAlignment.Left)] 1126[InlineData(1, HorizontalAlignment.Right, HorizontalAlignment.Right)] 1127public void ColumnHeader_TextAlign_SetWithListView_GetReturnsExpected(int columnIndex, HorizontalAlignment value, HorizontalAlignment expected) 1146[InlineData(0, HorizontalAlignment.Center, HorizontalAlignment.Left)] 1147[InlineData(0, HorizontalAlignment.Left, HorizontalAlignment.Left)] 1148[InlineData(0, HorizontalAlignment.Right, HorizontalAlignment.Left)] 1149[InlineData(1, HorizontalAlignment.Center, HorizontalAlignment.Center)] 1150[InlineData(1, HorizontalAlignment.Left, HorizontalAlignment.Left)] 1151[InlineData(1, HorizontalAlignment.Right, HorizontalAlignment.Right)] 1152public void ColumnHeader_TextAlign_SetWithListViewWithHandle_GetReturnsExpected(int columnIndex, HorizontalAlignment value, HorizontalAlignment expected) 1184[InlineData(0, HorizontalAlignment.Center, 0x4000)] 1185[InlineData(0, HorizontalAlignment.Left, 0x4000)] 1186[InlineData(0, HorizontalAlignment.Right, 0x4000)] 1187[InlineData(1, HorizontalAlignment.Center, 0x4002)] 1188[InlineData(1, HorizontalAlignment.Left, 0x4000)] 1189[InlineData(1, HorizontalAlignment.Right, 0x4001)] 1190public unsafe void ColumnHeader_TextAlign_GetColumn_Success(int columnIndex, HorizontalAlignment value, int expected) 1209[InvalidEnumData<HorizontalAlignment>] 1210public void ColumnHeader_TextAlign_SetInvalid_ThrowsInvalidEnumArgumentException(HorizontalAlignment value) 1469TextAlign = HorizontalAlignment.Center, 1485Assert.Equal(HorizontalAlignment.Center, header.TextAlign); 1506TextAlign = HorizontalAlignment.Center, 1524Assert.Equal(HorizontalAlignment.Center, header.TextAlign); 1544TextAlign = HorizontalAlignment.Center, 1564Assert.Equal(HorizontalAlignment.Center, header.TextAlign);
System\Windows\Forms\ControlTests.cs (4)
1412public new HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) => base.RtlTranslateAlignment(align); 1420public new HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) => base.RtlTranslateHorizontal(align);
System\Windows\Forms\ControlTests.Methods.cs (12)
6891public void Control_RtlTranslateAlignment_InvokeHorizontalAlignment_ReturnsExpected(RightToLeft rightToLeft, HorizontalAlignment align, HorizontalAlignment expected) 6970foreach (HorizontalAlignment align in Enum.GetValues(typeof(HorizontalAlignment))) 6976yield return new object[] { RightToLeft.Yes, HorizontalAlignment.Center, HorizontalAlignment.Center }; 6977yield return new object[] { RightToLeft.Yes, HorizontalAlignment.Left, HorizontalAlignment.Right }; 6978yield return new object[] { RightToLeft.Yes, HorizontalAlignment.Right, HorizontalAlignment.Left }; 6983public void Control_RtlTranslateHorizontal_Invoke_ReturnsExpected(RightToLeft rightToLeft, HorizontalAlignment align, HorizontalAlignment expected)
System\Windows\Forms\DataGridViewTextBoxEditingControlTests.cs (45)
120Assert.Equal(HorizontalAlignment.Left, control.TextAlign); 546yield return new object[] { new DataGridViewCellStyle(), null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false }; 555yield return new object[] { customStyle, font, Color.Gray, Color.Green, false, HorizontalAlignment.Left, false }; 563yield return new object[] { transparentStyle, font, Color.FromArgb(0xFF, 0x34, 0x56, 0x78), Color.FromArgb(0x23, 0x45, 0x67, 0x80), false, HorizontalAlignment.Left, false }; 572null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 581null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, true 590null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 599null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, true 608null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 617null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, true 627null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 636null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, true 645null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 654null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, true 663null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 672null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, true 682null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 691null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, false 700null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 709null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, false 718null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 727null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, false 733public void DataGridViewTextBoxEditingDataGridViewTextBoxEditingControl_ApplyCellStyleToEditingDataGridViewTextBoxEditingControl_Invoke_Success(DataGridViewCellStyle dataGridViewCellStyle, Font expectedFont, Color expectedBackColor, Color expectedForeColor, bool expectedWordWrap, HorizontalAlignment expectedTextAlign, bool expectedRepositionOnValueChange) 755yield return new object[] { new DataGridViewCellStyle(), null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false }; 764yield return new object[] { customStyle, font, Color.Gray, SystemColors.Control, Color.Green, false, HorizontalAlignment.Left, false }; 772yield return new object[] { transparentStyle, font, Color.FromArgb(0xFF, 0x34, 0x56, 0x78), Color.FromArgb(0xFF, 0x34, 0x56, 0x78), Color.FromArgb(0x23, 0x45, 0x67, 0x80), false, HorizontalAlignment.Left, false }; 781null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 790null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, true 799null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 808null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, true 817null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 826null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, true 836null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 845null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, true 854null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 863null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, true 872null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 881null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, true 891null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Center, false 900null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Center, false 909null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Left, false 918null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Left, false 927null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, false, HorizontalAlignment.Right, false 936null, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), SystemColors.WindowText, true, HorizontalAlignment.Right, false 942public void DataGridViewTextBoxEditingDataGridViewTextBoxEditingControl_ApplyCellStyleToEditingDataGridViewTextBoxEditingControl_InvokeWithDataGridView_Success(DataGridViewCellStyle dataGridViewCellStyle, Font expectedFont, Color expectedBackColor, Color expectedEditingPanelBackColor, Color expectedForeColor, bool expectedWordWrap, HorizontalAlignment expectedTextAlign, bool expectedRepositionOnValueChange)
System\Windows\Forms\DomainUpDownTests.cs (1)
140_sub.TextAlign.Should().Be(HorizontalAlignment.Left);
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (4)
82[InlineData(HorizontalAlignment.Left)] 83[InlineData(HorizontalAlignment.Center)] 84[InlineData(HorizontalAlignment.Right)] 85public void DrawListViewColumnHeaderEventArgs_DrawText_Invoke_Success(HorizontalAlignment textAlign)
System\Windows\Forms\ListViewGroupConverterTests.cs (9)
175new Type[] { typeof(string), typeof(HorizontalAlignment) }, 176new object[] { "ListViewGroup", HorizontalAlignment.Left } 181new Type[] { typeof(string), typeof(HorizontalAlignment) }, 182new object[] { "headerText", HorizontalAlignment.Left } 187new Type[] { typeof(string), typeof(HorizontalAlignment) }, 188new object[] { "header", HorizontalAlignment.Left } 192new ListViewGroup("header", HorizontalAlignment.Center), 193new Type[] { typeof(string), typeof(HorizontalAlignment) }, 194new object[] { "header", HorizontalAlignment.Center }
System\Windows\Forms\ListViewGroupTests.cs (52)
19Assert.Equal(HorizontalAlignment.Left, group.FooterAlignment); 21Assert.Equal(HorizontalAlignment.Left, group.HeaderAlignment); 40Assert.Equal(HorizontalAlignment.Left, group.FooterAlignment); 42Assert.Equal(HorizontalAlignment.Left, group.HeaderAlignment); 57yield return new object[] { null, HorizontalAlignment.Left, string.Empty }; 58yield return new object[] { string.Empty, HorizontalAlignment.Right, string.Empty }; 59yield return new object[] { "reasonable", HorizontalAlignment.Center, "reasonable" }; 60yield return new object[] { "reasonable", HorizontalAlignment.Left - 1, "reasonable" }; 61yield return new object[] { "reasonable", HorizontalAlignment.Center + 1, "reasonable" }; 66public void ListViewGroup_Ctor_String_HorizontalAlignment(string header, HorizontalAlignment headerAlignment, string expectedHeader) 70Assert.Equal(HorizontalAlignment.Left, group.FooterAlignment); 98Assert.Equal(HorizontalAlignment.Left, group.FooterAlignment); 100Assert.Equal(HorizontalAlignment.Left, group.HeaderAlignment); 639foreach (HorizontalAlignment value in Enum.GetValues(typeof(HorizontalAlignment))) 649public void ListViewGroup_FooterAlignment_SetWithoutListView_GetReturnsExpected(string footer, HorizontalAlignment value, string expectedFooter) 668public void ListViewGroup_FooterAlignment_SetWithListView_GetReturnsExpected(string footer, HorizontalAlignment value, string expectedFooter) 692public void ListViewGroup_FooterAlignment_SetWithListViewWithHandle_GetReturnsExpected(string footer, HorizontalAlignment value, string expectedFooter) 729yield return new object[] { string.Empty, HorizontalAlignment.Left, 0x00000008 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 730yield return new object[] { string.Empty, HorizontalAlignment.Center, 0x00000010 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 731yield return new object[] { string.Empty, HorizontalAlignment.Right, 0x00000020 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 733yield return new object[] { "footer", HorizontalAlignment.Left, 0x00000008 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 734yield return new object[] { "footer", HorizontalAlignment.Center, 0x00000010 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 735yield return new object[] { "footer", HorizontalAlignment.Right, 0x00000020 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_HEADER_LEFT }; 740public unsafe void ListView_FooterAlignment_GetGroupInfo_Success(string footerParam, HorizontalAlignment valueParam, int expectedAlignParam) 745HorizontalAlignment value = (HorizontalAlignment)Enum.Parse(typeof(HorizontalAlignment), valueString); 778[InvalidEnumData<HorizontalAlignment>] 779public void ListViewGroup_FooterAlignment_SetInvalid_ThrowsInvalidEnumArgumentException(HorizontalAlignment value) 899public void ListViewGroup_HeaderAlignment_SetWithoutListView_GetReturnsExpected(string header, HorizontalAlignment value, string expectedHeader) 918public void ListViewGroup_HeaderAlignment_SetWithListView_GetReturnsExpected(string header, HorizontalAlignment value, string expectedHeader) 942public void ListViewGroup_HeaderAlignment_SetWithListViewWithHandle_GetReturnsExpected(string header, HorizontalAlignment value, string expectedHeader) 979yield return new object[] { string.Empty, HorizontalAlignment.Left, 0x00000001 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 980yield return new object[] { string.Empty, HorizontalAlignment.Center, 0x00000002 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 981yield return new object[] { string.Empty, HorizontalAlignment.Right, 0x00000004 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 983yield return new object[] { "header", HorizontalAlignment.Left, 0x00000001 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 984yield return new object[] { "header", HorizontalAlignment.Center, 0x00000002 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 985yield return new object[] { "header", HorizontalAlignment.Right, 0x00000004 | (int)LIST_VIEW_GROUP_ALIGN_FLAGS.LVGA_FOOTER_LEFT }; 990public unsafe void ListView_HeaderAlignment_GetGroupInfo_Success(string headerParam, HorizontalAlignment valueParam, int expectedAlignParam) 995HorizontalAlignment value = (HorizontalAlignment)Enum.Parse(typeof(HorizontalAlignment), valueString); 1028[InvalidEnumData<HorizontalAlignment>] 1029public void ListViewGroup_HeaderAlignment_SetInvalid_ThrowsInvalidEnumArgumentException(HorizontalAlignment value) 1319yield return new object[] { new ListViewGroup("header", HorizontalAlignment.Center) { Name = "name", Tag = "tag" } }; 1370Assert.Equal(HorizontalAlignment.Left, info.GetValue("HeaderAlignment", typeof(HorizontalAlignment))); 1388Assert.Equal(HorizontalAlignment.Left, info.GetValue("HeaderAlignment", typeof(HorizontalAlignment))); 1406Assert.Equal(HorizontalAlignment.Left, info.GetValue("HeaderAlignment", typeof(HorizontalAlignment)));
System\Windows\Forms\ListViewTests.cs (28)
1876yield return new object[] { showGroups, null, HorizontalAlignment.Left, null, HorizontalAlignment.Right, string.Empty, string.Empty, 0x00000021 }; 1877yield return new object[] { showGroups, null, HorizontalAlignment.Center, null, HorizontalAlignment.Center, string.Empty, string.Empty, 0x00000012 }; 1878yield return new object[] { showGroups, null, HorizontalAlignment.Right, null, HorizontalAlignment.Left, string.Empty, string.Empty, 0x0000000C }; 1880yield return new object[] { showGroups, string.Empty, HorizontalAlignment.Left, string.Empty, HorizontalAlignment.Right, string.Empty, string.Empty, 0x00000021 }; 1881yield return new object[] { showGroups, string.Empty, HorizontalAlignment.Center, string.Empty, HorizontalAlignment.Center, string.Empty, string.Empty, 0x00000012 }; 1882yield return new object[] { showGroups, string.Empty, HorizontalAlignment.Right, string.Empty, HorizontalAlignment.Left, string.Empty, string.Empty, 0x0000000C }; 1884yield return new object[] { showGroups, "header", HorizontalAlignment.Left, "footer", HorizontalAlignment.Right, "header", "footer", 0x00000021 }; 1885yield return new object[] { showGroups, "header", HorizontalAlignment.Center, "footer", HorizontalAlignment.Center, "header", "footer", 0x00000012 }; 1886yield return new object[] { showGroups, "header", HorizontalAlignment.Right, "footer", HorizontalAlignment.Left, "header", "footer", 0x0000000C }; 1888yield return new object[] { showGroups, "he\0der", HorizontalAlignment.Left, "fo\0oter", HorizontalAlignment.Right, "he", "fo", 0x00000021 }; 1889yield return new object[] { showGroups, "he\0der", HorizontalAlignment.Center, "fo\0oter", HorizontalAlignment.Center, "he", "fo", 0x00000012 }; 1890yield return new object[] { showGroups, "he\0der", HorizontalAlignment.Right, "fo\0oter", HorizontalAlignment.Left, "he", "fo", 0x0000000C }; 1907HorizontalAlignment headerAlignment = (HorizontalAlignment)data[2]; 1909HorizontalAlignment footerAlignment = (HorizontalAlignment)data[4];
System\Windows\Forms\RichTextBoxTests.cs (31)
3637Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3641Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3657Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3664Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3673yield return new object[] { 0, 0, HorizontalAlignment.Left }; 3674yield return new object[] { 0, PFA.CENTER, HorizontalAlignment.Left }; 3675yield return new object[] { PFM.ALIGNMENT, PFA.LEFT, HorizontalAlignment.Left }; 3676yield return new object[] { PFM.ALIGNMENT, PFA.CENTER, HorizontalAlignment.Center }; 3677yield return new object[] { PFM.ALIGNMENT, PFA.RIGHT, HorizontalAlignment.Right }; 3678yield return new object[] { PFM.ALIGNMENT, PFA.JUSTIFY, HorizontalAlignment.Left }; 3679yield return new object[] { PFM.ALIGNMENT, PFA.FULL_INTERWORD, HorizontalAlignment.Left }; 3680yield return new object[] { PFM.ALIGNMENT | PFM.ALIGNMENT, PFA.CENTER, HorizontalAlignment.Center }; 3681yield return new object[] { PFM.NUMBERING, PFA.CENTER, HorizontalAlignment.Left }; 3686public void RichTextBox_SelectionAlignment_CustomGetParaFormat_ReturnsExpected(uint mask, uint alignment, HorizontalAlignment expected) 3705Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3718[EnumData<HorizontalAlignment>] 3719public void RichTextBox_SelectionAlignment_Set_GetReturnsExpected(HorizontalAlignment value) 3735[EnumData<HorizontalAlignment>] 3736public void RichTextBox_SelectionAlignment_SetWithHandle_GetReturnsExpected(HorizontalAlignment value) 3764[InlineData(HorizontalAlignment.Left, 1)] 3765[InlineData(HorizontalAlignment.Center, 3)] 3766[InlineData(HorizontalAlignment.Right, 2)] 3767public unsafe void RichTextBox_SelectionAlignment_GetCharFormat_Success(HorizontalAlignment value, int expected) 3786[InvalidEnumData<HorizontalAlignment>] 3787public void RichTextBox_SelectionAlignment_SetInvalidValue_ThrowsInvalidEnumArgumentException(HorizontalAlignment value) 3794[EnumData<HorizontalAlignment>] 3795public void RichTextBox_SelectionAlignment_SetCantCreateHandle_GetReturnsExpected(HorizontalAlignment value) 3799Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3804Assert.Equal(HorizontalAlignment.Left, control.SelectionAlignment); 3809[EnumData<HorizontalAlignment>] 3810public void RichTextBox_SelectionAlignment_SetDisposed_ThrowsObjectDisposedException(HorizontalAlignment value)
System\Windows\Forms\ToolStripTextBoxTests.cs (14)
332[InlineData(HorizontalAlignment.Left)] 333[InlineData(HorizontalAlignment.Center)] 334[InlineData(HorizontalAlignment.Right)] 335public void ToolStripTextBox_TextBoxTextAlign_GetSet_ReturnsExpected(HorizontalAlignment textAlign) 650_toolStripTextBox.TextBoxTextAlign = HorizontalAlignment.Center; 652_toolStripTextBox.TextBoxTextAlign.Should().Be(HorizontalAlignment.Center); 655_toolStripTextBox.TextBoxTextAlign = HorizontalAlignment.Left; 657_toolStripTextBox.TextBoxTextAlign.Should().Be(HorizontalAlignment.Left); 669_toolStripTextBox.TextBoxTextAlign = HorizontalAlignment.Center; 672_toolStripTextBox.TextBoxTextAlign.Should().Be(HorizontalAlignment.Center); 675_toolStripTextBox.TextBoxTextAlign = HorizontalAlignment.Left; 678_toolStripTextBox.TextBoxTextAlign.Should().Be(HorizontalAlignment.Left); 681_toolStripTextBox.TextBoxTextAlign = HorizontalAlignment.Center; 684_toolStripTextBox.TextBoxTextAlign.Should().Be(HorizontalAlignment.Center);
System\Windows\Forms\UpDownBaseTests.cs (7)
123Assert.Equal(HorizontalAlignment.Left, control.TextAlign); 1374[EnumData<HorizontalAlignment>] 1375public void UpDownBase_TextAlign_Set_GetReturnsExpected(HorizontalAlignment value) 1391[EnumData<HorizontalAlignment>] 1392public void UpDownBase_TextAlign_SetWithHandle_GetReturnsExpected(HorizontalAlignment value) 1420[InvalidEnumData<HorizontalAlignment>] 1421public void UpDownBase_TextAlign_SetInvalidValue_ThrowsInvalidEnumArgumentException(HorizontalAlignment value)
TextBoxTests.cs (5)
113Assert.Equal(HorizontalAlignment.Left, control.TextAlign); 421tb.TextAlign = HorizontalAlignment.Center; 423tb.TextAlign = HorizontalAlignment.Right; 440tb.TextAlign = HorizontalAlignment.Center; 442tb.TextAlign = HorizontalAlignment.Right;
System.Windows.Forms.UI.IntegrationTests (1)
ListViewTests.cs (1)
50ListViewGroup group = new($"Group 1", HorizontalAlignment.Left) { CollapsedState = ListViewGroupCollapsedState.Expanded };
WinFormsControlsTest (9)
DataGridViewTest.Designer.cs (1)
174this.numericUpDown1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
ListViewTest.cs (4)
119listView2.Columns.Add("column1", "Item Column", -2, HorizontalAlignment.Left, 0); 120listView2.Columns.Add("Column 2", -2, HorizontalAlignment.Left); 121listView2.Columns.Add("Column 3", -2, HorizontalAlignment.Left); 122listView2.Columns.Add("Column 4", -2, HorizontalAlignment.Center);
MultipleControls.cs (4)
81listView2.Columns.Add("column1", "Item Column", -2, HorizontalAlignment.Left, 0); 82listView2.Columns.Add("Column 2", -2, HorizontalAlignment.Left); 83listView2.Columns.Add("Column 3", -2, HorizontalAlignment.Left); 84listView2.Columns.Add("Column 4", -2, HorizontalAlignment.Center);