This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Jamie  
#1 Posted : Sunday, May 14, 2006 12:42:02 PM(UTC)
Jamie

Rank: Member

Groups: Guest
Joined: 5/14/2006(UTC)
Posts: 1

Hi there,

I'm currently evaluating the product.

Have followed your example about creating custom list items. All I want to do is to add a couple of custom columns, is there an easy way to do this, and could someone provide me with some sample code if possible?

Thanks,

Jamie

Alex Kon  
#2 Posted : Sunday, May 14, 2006 5:38:40 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Guest
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi, Jamie,

If you want just to add some columns you can inherit your custom list item class from the Aurigma.GraphicsMill.WinControls.ThumbnailListItem class and overload GetText method only. You can use the following code snippet as base for your code:

Code:
public class CustomThumbItem: Aurigma.GraphicsMill.WinControls.ThumbnailListItem
{
	public CustomThumbItem(string path, string additionalText)
		: base(path)
	{
		_additionalText = additionalText;
	}

	public override string GetText(int textInfoId)
	{
		if (textInfoId != 40 /*your custom TextID*/)
			return base.GetText (textInfoId);
		else 
			return _additionalText;
	}

	private string _additionalText;
}
And, for example, you can use this implementation of the IListItem in such way:
Code:
thumbnailListView1.Columns.Add(new Aurigma.GraphicsMill.WinControls.ListColumn(40/*your custom TextID*/, "CustomField", 300, System.Windows.Forms.HorizontalAlignment.Center));

string[] filenames = System.IO.Directory.GetFiles(@"x:\allFormats");
CustomThumbItem[] items = new CustomThumbItem[filenames.Length];

int i = 0;
foreach (string filename in filenames)
{
	string additionalInfo;
	try
	{
		Aurigma.GraphicsMill.Bitmap image = new Aurigma.GraphicsMill.Bitmap(filename);
		additionalInfo = string.Format("Image: {0}x{1} {2}", image.Width, image.Height, image.PixelFormat);
	}
	catch
	{
		additionalInfo = "Cannot load specified file.";
	}

	items[i++] = new CustomThumbItem(filename, additionalInfo);
}

thumbnailListView1.Items.Add(items);

Edited by user Thursday, December 20, 2007 4:34:05 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.