protected void RegisterColumn(string title, uint defaultWidthInCharacters,
                                      ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString)
        {
            Contract.Requires(title != null);
            Contract.Requires(title.Length < ShellColumnInfo.MaxTitleLength);

            RegisterColumn(GetStandardFormatIdentifier(), columnInfos.Count, title, defaultWidthInCharacters, format, state);
        }
Beispiel #2
0
        protected void RegisterColumn(string title, uint defaultWidthInCharacters,
                                      ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString)
        {
            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }
            if (title.Length > ShellColumnInfo.MaxTitleLength)
            {
                throw new ArgumentException("title.Length > ShellColumnInfo.MaxTitleLength", nameof(title));
            }

            RegisterColumn(GetStandardFormatIdentifier(), columnInfos.Count, title, defaultWidthInCharacters, format, state);
        }
		public ListView()
		{
			items = new ListViewItemCollection(this);
			columns = new ColumnHeaderCollection(this);
			listItems = new ArrayList();
			autoArrange = true;
			hideSelection = true;
			labelWrap = true;
			multiSelect = true;
			scrollable = true;
			activation = ItemActivation.Standard;
			alignStyle = ListViewAlignment.Top;
			borderStyle = BorderStyle.Fixed3D;
			headerStyle = ColumnHeaderStyle.Clickable;
			sorting = SortOrder.None;
			viewStyle = View.LargeIcon;
		}
Beispiel #4
0
        protected void RegisterColumn(Guid formatId, int propertyId, string title, uint defaultWidthInCharacters,
                                      ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString)
        {
            var columnId = new ShellColumnId {
                FormatId = formatId, PropertyId = propertyId
            };

            // Note: description field is not used by the shell.
            var columnInfo = new ShellColumnInfo
            {
                ColumnId = columnId,
                Title    = title,
                DefaultWidthInCharacters = defaultWidthInCharacters,
                Format      = format,
                State       = state | ShellColumnState.Extended | ShellColumnState.SecondaryUI,
                variantType = 0
            };

            // Note: VT_LPSTR/VT_BSTR works ok. Other types seems to have issues with sorting.
            // TODO = VT_BSTR

            columnInfos.Add(columnInfo);
        }
        protected void RegisterColumn(Guid formatId, int propertyId, string title, uint defaultWidthInCharacters,
                                      ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString)
        {
            Contract.Requires(title != null);
            Contract.Requires(title.Length < ShellColumnInfo.MaxTitleLength);

            var columnId = new ShellColumnId {
                FormatId = formatId, PropertyId = propertyId
            };

            // Note: description field is not used by the shell.
            var columnInfo = new ShellColumnInfo();

            columnInfo.ColumnId = columnId;
            columnInfo.Title    = title;
            columnInfo.DefaultWidthInCharacters = defaultWidthInCharacters;
            columnInfo.Format = format;
            columnInfo.State  = state | ShellColumnState.Extended | ShellColumnState.SecondaryUI;

            // Note: VT_LPSTR/VT_BSTR works ok. Other types seems to have issues with sorting.
            columnInfo.variantType = 0; // TODO = VT_BSTR

            columnInfos.Add(columnInfo);
        }
Beispiel #6
0
		public void ArrangeIcons (ListViewAlignment value)
		{
			// Icons are arranged only if view is set to LargeIcon or SmallIcon
			if (view == View.LargeIcon || view == View.SmallIcon)
				Redraw (true);
		}
Beispiel #7
0
		private void CalculateListView (ListViewAlignment align)
		{
			CalcTextSize ();

			AdjustItemsPositionArray (items.Count);

			switch (view) {
			case View.Details:
				LayoutDetails ();
				break;

			case View.SmallIcon:
				LayoutIcons (SmallIconItemSize, alignment == ListViewAlignment.Left, 
						ThemeEngine.Current.ListViewHorizontalSpacing, 2);
				break;

			case View.LargeIcon:
				LayoutIcons (LargeIconItemSize, alignment == ListViewAlignment.Left,
					ThemeEngine.Current.ListViewHorizontalSpacing,
					ThemeEngine.Current.ListViewVerticalSpacing);
				break;

			case View.List:
				LayoutIcons (SmallIconItemSize, true, 
						ThemeEngine.Current.ListViewHorizontalSpacing, 2);
				break;
			case View.Tile:
				if (!Application.VisualStylesEnabled)
					goto case View.LargeIcon;

				LayoutIcons (TileItemSize, alignment == ListViewAlignment.Left, 
						ThemeEngine.Current.ListViewHorizontalSpacing,
						ThemeEngine.Current.ListViewVerticalSpacing);
				break;
			}

			CalculateScrollBars ();
		}
Beispiel #8
0
 public static extern bool ListView_Arrange
 (
     IntPtr hwnd,
     ListViewAlignment code
 );
Beispiel #9
0
        private void ChangeInputAlignment(ListViewAlignment align)
        {
            lvwPictures.Alignment = align;

            foreach (ToolStripMenuItem Item in alignmentToolStripMenuItem.DropDownItems)
            {
                Item.Checked = false;
            }
        }
Beispiel #10
0
        /// <include file='doc\ListView.uex' path='docs/doc[@for="ListView.ArrangeIcons"]/*' />
        /// <devdoc>
        ///     In Large Icon or Small Icon view, arranges the items according to one
        ///     of the following behaviors:
        /// </devdoc>
        public void ArrangeIcons(ListViewAlignment value) {
            // LVM_ARRANGE only work in SmallIcon view
            if (viewStyle != View.SmallIcon) return;

            switch ((int)value) {
                case NativeMethods.LVA_DEFAULT:
                case NativeMethods.LVA_ALIGNLEFT:
                case NativeMethods.LVA_ALIGNTOP:
                case NativeMethods.LVA_SNAPTOGRID:
                    if (IsHandleCreated) {
                        UnsafeNativeMethods.PostMessage(new HandleRef(this, this.Handle), NativeMethods.LVM_ARRANGE, (int) value, 0);
                    }
                    break;

                default:
                    throw new ArgumentException(SR.GetString(SR.InvalidArgument,
                                                              "value",
                                                              ((value).ToString())));
            }

            if (!VirtualMode && sorting != SortOrder.None) {
                Sort();
            }

        }
		public void ArrangeIcons(ListViewAlignment value)
		{
			if (viewStyle == View.Details)
			{
				return; 
			}
			if (sorting != SortOrder.None)
			{
				Sort();
			}
		}
 public void ArrangeIcons(ListViewAlignment value)
 {
     if (this.viewStyle == System.Windows.Forms.View.SmallIcon)
     {
         switch (((int) value))
         {
             case 0:
             case 1:
             case 2:
             case 5:
                 if (base.IsHandleCreated)
                 {
                     System.Windows.Forms.UnsafeNativeMethods.PostMessage(new HandleRef(this, base.Handle), 0x1016, (int) value, 0);
                 }
                 if (!this.VirtualMode && (this.sorting != SortOrder.None))
                 {
                     this.Sort();
                 }
                 return;
         }
         throw new ArgumentException(System.Windows.Forms.SR.GetString("InvalidArgument", new object[] { "value", value.ToString() }));
     }
 }
	public void ArrangeIcons(ListViewAlignment value) {}
 public void ArrangeIcons(ListViewAlignment value)
 {
 }
Beispiel #15
0
 public new void ArrangeIcons(ListViewAlignment value)
 {
     throw new NotSupportedException(NotSupportedMessage);
 }
Beispiel #16
0
 public void ArrangeIcons(ListViewAlignment value)
 {
     throw null;
 }