|
First you need to add three columns to the ListView 's Columns collection, either with the designer or by code:
ColumnHeader ch = new ColumnHeader();
ch.Text = "";
ch.Width = 35;
listView1.Columns.Add(ch);
ch = new ColumnHeader();
ch.Text = "Size";
ch.Width = 80;
listView1.Columns.Add(ch);
You then need to create an ImageList and add all the 16x16 images that could be displayed (while in detail view 16x16 pixel images are displayed), and then set the image list to the ListView control:
ImageList il = new ImageList();
il.Images.Add(bm1);
il.Images.Add(bm2);
listVie1.SmallImageList = il; Finally you add the items:
ListViewItem item = new ListViewItem("");
item.ImageIndex = 0;
item.SubItems.Add(String.Format("{0}x{1}", widht, height);
item.SubItems.Add(fullPath);
listView1.Items.Add(item);
I hope this helps. Any questions feel free to ask again.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
yes but i detail display mode (with coulmn) it is not displayed images, but just when iconList or Largicon.
Then i need to set bigger images then 16x16, can i?
Then can i set different image size in preview so to have 16x16 for 1 item, 32x30 the second, 30x25 the third...
tnx for your help.
|
|
|
|
|
In detail view you can also display images (see detail view in Windows Explorer for an example.) You just have to set the ImageIndex property of the ListViewItem and a SmallImageList to the ListView .
But you can't set different image size for each item. Since you specify images in an ImageList , they are all required to have the same size.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I'm working on an application in C#, which has the capabilities of displaying and processing images. (one at a time, the images are rather large but I finally decided on resizing them to moderate sizes (e.g. 600*600))
There's not much image processing involved but zoom, mirroring, rotation and brightness change should be possible.
The most important fact is performance. The image should be displayed very fast and the image processing steps sould be very fast too.
I'm trying to brainstorm some new ideas of doing the displaying and image processing because I tried so many things but I'm not satisfied with the results. I tried it with GDI+ (with and without brushes) and with Managed DirectX (Direct3D and also DirectDraw).
Anyone here has good ideas of doing it? Am I on the right path or did I miss a possibility?
Right now I tend to do it with GDI+ because DirectX does not really work faster and is more complicated to use.
thank you very much.
-- modified at 10:22 Tuesday 30th August, 2005
|
|
|
|
|
Hello
What performance would you like to get ? I am using GDI+ and C# for image processing tasks in research areas and it's almost satisfy me. Yes, it's impossible to get such performance to use it in video processing, bit for most image processing tasks GDI+ is almost good enough.
There is one great think, that troubles me much and it's leading to performance decrease. As we know the fastest way of image processing is using LockBits and processing data in unsafe block. But, on each LockBits call GDI+ coping the image memory block. And it is sux.
So, if you want to implement very fast image processing tools, which can be applied to video processing too, I think you should think about C/C++. As an example look at Intel's library [^].
With best regards,
Andrew
|
|
|
|
|
Hello Andrew,
thank you for your reply. I already use the Lockbits-method and it gave a good performance boost once I implemented it weeks ago. But the performance is still not good enough.
I decided to just use C# and no C, but maybe thats the only possibilty to make it faster now.
One big problem is that a brightness change should work in realtime, the user should see the change immediately. I tried it with indexed bitmaps and a Change of the Palette of this bitmap, which works wonderful but is still a litle slow.
For that reason I wanted to decrease the size of the bitmap before changing the brightness. For that reason I used the Bitmap-Constructor which requires a Bitmap and the Width and Height of the new Bitmap as paramters:
public Bitmap ( System.Drawing.Image original , System.Int32 width , System.Int32 height)<br />
But the bitmap this constructor delivers doe not have a Palette.
So I cannot change the Brightness by changing the palette.
Anyone has experience with that?
|
|
|
|
|
|
Hello...
The point of the question is : how portable should be your app...
To use Managed DirectX u need to install it...
Ok... But Managed DirectX is one possible way to optimize your performance...
Another way is to use Platform Invoke from the native Window GDI API...
f.e.: the native StretchBlt Function to doing zooming operation...
Best regards...
|
|
|
|
|
I like to run Java components from C# does anybody know how to do this?
|
|
|
|
|
|
|
I'm displaying a bitmap Image with DirectDraw.
Now I want to change the Brightness of the image. I thought it could work by changing the Palette.
The problem is that I am not able to add a palette to a surface. I tried to add it with the constructor for the Palette which needs a Surface as argument.
Is it possible to change the pixelFormat of the Surface. If O could set in to 8bppIndexed then I would also have a palette, right?
I think it is very hard to work with Direct Draw because the DirectDraw documentation in ManagedDirectX 9.0 is very bad.
Can anyone help?
Thank you very much
-- modified at 9:05 Wednesday 31st August, 2005
|
|
|
|
|
Dear sir,
What is the safty and the easy way for the right sequance steps to connect to the sql DB and open it and close it without any problems ad how can i in a programmatical way to avoid the logic & physical error
Thanks for all
Wael El Assal
Indystry data analyst
DSD-Ferrometalco
|
|
|
|
|
Create a connection object for the connection type you use, like an OleDbConnection object.
Put the connection string in the call to the constructor.
Create a command object for the connection type, like an OleDbCommand object.
Set the CommandText and CommandType properties.
Add parameter objects to the command object for any parameters you use in the query.
Open the connection.
Run the query using the method in the command object that fits what you want to do.
Dispose of the command object.
Dispose of the connection object. (This will automatically close the connection.)
---
b { font-weight: normal; }
|
|
|
|
|
Like this:
public void Foo(string connectionString)
{
using (SqlConnection connection = new SqlConnection(connectionString) )
{
}
}
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
dear All,
Thanks for your quick replay,
My application designed to be distributed app. on a network & 30 users & sql server DB & C#.net I put the DB on the (server Pc.
this is the first time using C# tool so,please advice which kind of provider sugest to use SQl, Oledb, Odbc,...) which make the connection and the perfomance is very smothly on the network.
Thanks for this kindly help
Wael Elassa
|
|
|
|
|
we have a very huge distributed system and we make a lot of updates, a lot of bugs fixing and a lot of adding new features so I want to know if there is a versioning method rather than Assembly version to keep track with the system versions (major, minor, SPs) for every change and every update we made
Please any one know or have any paper talking about this subject, please inform me asap
|
|
|
|
|
Aloha,
We would like to make some nice controls based on the classic ASP.NET webcontrols. In order to secure that this is done probably, we would like to define an interface which defines the following:
interface IControl<br />
{<br />
void OnInit(EventArgs e);<br />
<br />
void Render(HtmlTextWriter output);<br />
<br />
string HeaderText<br />
{<br />
get;<br />
set;<br />
}<br />
}
The interface definitions of OnInit() and Render() are supposed to remind the coder that he should override the methods in the ASP.NET webcontrol. The problem is that these methods are protected and we therefore get the following error:
'MyButton' does not implement interface member 'IControl.OnInit(System.EventArgs)'. 'MyButton.OnInit(System.EventArgs)' is either static, not public, or has the wrong return type.
The HeaderText property works perfectly, but that is because it is implemented as public in the MyButton class.
Any ideas? If possible, we would love to be able to define protected methods in our interface... and if not possible, we would love to hear about another way of forcing the coders to implement everything.
Thanks, Mads
|
|
|
|
|
|
Thanks for your reply.
We can't make the methods public since their are defined as protected in the ASP.NET controls that we inherit from (no change of access allowed when overriding base methods).
Also, we cannot use protected abstract since C# doesn't allow multiple inheritance (we already inherit from the control we want to extend).
"private explicit interface implementations" doesn't allow us to change access to a method, it still have to be the same as for the base class - so this is also a no go
// Mads
|
|
|
|
|
|
Override the methods with a method that throws an (informative) exception. That way the coder have to override also.
---
b { font-weight: normal; }
|
|
|
|
|
How would you do that? When don't have a "middle" class where we can do the overriding.
Each of our control classes derive directly from a webcontrol - I think adding a class between the webcontrol and our class would be the same as doing most of the work ourselves
|
|
|
|
|
Then you can't do it. You cannot change the behaviour of a class using interfaces, you can only specify behaviour to be added. To change the behaviour of a class you need to inherit it.
---
b { font-weight: normal; }
|
|
|
|
|
We don't want to change the behaviour - we just want to make sure that some protected methods are overriden in the classes that inehrit from the base class.
Thanks for your help.
|
|
|
|