|
Hey all,
I'm trying to make an imagelist display images in listview with their correct dimensions, by creating a bitmap & calculating the dimensions. I've got that far, but when I load the image, it stretches it to 72x72 defined at design time. I'm wondering if the dimensions can be changed, per image, at runtime.
I've tried ilsource.ImageSize = New Size((width), (height)) but it's not per image & the images don't load at all.
Hope someone can help, cheers.
-piniata.
|
|
|
|
|
ImageList cannot handle images of differing sizes. It'll only hanlde images of the same size between 1x1 and 256x256 pixels in size. ImageList is normally used to hold icon images for other controls, such as the TreeView, ListView or ToolBar, each of which expects images of the same size.
If you want to hold a bunch of images of varying sizes for other purposes, I suggest making your own Images collection.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Cheers Dave,
The imagelist is for a thumbnail view on a listview.. how would I go about making an images collection? Would that just be an array of images?
Thanks again
piniata.
|
|
|
|
|
There's a bunch of different ways to make your own collection. It can be as simple as an array of Image or Bitmap objects. You can use an existing collection, like a HashTable, or you can make your own Collection from scratch, implementing the ICollection interface, or IList and the IEnumerable interfaces. It depends on how you want to access these images and the kind of control you want to have over the collection. Search for those interface names on MSDN and the documentation will explain more about how they work and what those interfaces expect from you. Or don't, and just go with an array of Image objects.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi!
I am new to winforms. I just want following to happen a code sample will be great.
user enters username and password and instead of hitting the submit button user just hit enter now i want to fire this button click upon hitting enter how i can do that
please help
|
|
|
|
|
look at the property of the form 'acceptbutton' by selecting the button you want, it automatically puts a handler on your form to react to the return key.
you can also manually setup a similar thing turning on the 'keypreview' property of the form and when the enter key is pressed call the click event of the button.
|
|
|
|
|
Can anyone give me one example like this
ToolstripCollection.Dropdown.add("String", System.Drawing.Image, System.EventHandler)
Thanks
................
|
|
|
|
|
It looks like you answered your own question.
|
|
|
|
|
Yes it is answer, but I don't know how to create eventhandler.
Help me
................
|
|
|
|
|
What is it that you want to do? Add an item to a toolstrip collection and handle events from it? Your question isn't very descriptive.
|
|
|
|
|
Yes I mean like that, I don't know how to do it.
Help me
................
|
|
|
|
|
I don't know how to use command.
example this HTML tag we use (mailto:socheat@khmerfriend.com) what about in VB.NET
................
|
|
|
|
|
What are you talking about? What are you trying to do? Are you trying to launch the default email editor?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes it can be, but I want user to send an email to with my address what command should i use. example if i just want to open oulook just use commnad(outlook).What about if i specific email address
................
|
|
|
|
|
Easy, just use:
Process.Start("mailto:socheat@khmerfriend.com")
|
|
|
|
|
Thanks, i hope can help me well.
................
|
|
|
|
|
Can anybody make a program in VB.NET (not in C#) to retrieve device information and detect when a device gets connected to a PC.I have already tried my hands in it but not get any related atricles on DEV_BROADCAST_DEVICEINTERFACE or GUID cass.Can it be done through System.InterOpServices.DLLImportAttribute?Mention the classes and properties of that classes.
Please Send me the solution ASAP
|
|
|
|
|
I might be wrong but I think that the only way to do this is by writing a driver. Devices being connected/disconnected cause an interrupt at KERNEL level, and those addresses are out of bounds in user mode.
|
|
|
|
|
i have ten(10) checkboxes on my application, users can only select or check 6 of these checkboxes. i would like to be able to display those 6 checked items on 6 labels after the click of a button.
could you help me with the code for this.
chiku
|
|
|
|
|
Do it with array of check boxes and run over it. if Chk(i).checked=true then msgbox (chk(i).text)
|
|
|
|
|
Hi all,
I'm trying to print out text and graphics on the same page using VB's Printer.Print
For i = 0 To List2.ListCount - 1 Step 1
Printer.Print List2.List(i)
Next i
If Clipboard.GetFormat(vbCFBitmap) Then
Printer.PaintPicture Clipboard.GetData(), 0, 0
Printer.EndDoc
End If
The graphics gets printed out, but the text from the list box doesn't. Any ideas on how I can resolve this? Thanks
MyFathersSon
|
|
|
|
|
Looks like the graphic might be overlaying the print buffer.
I would try the simplest approach first, and put an EndDoc after the listbox loop and see if that will flush the buffer without advancing the page.
Failing that, you might have to set the text and graphics onto a Form or Picture box first, and then call PrintForm.
|
|
|
|
|
Thanks for your suggestion. I placed a Printing.EndDoc statement as follows:
For i = 0 To List2.ListCount - 1 Step 1
Printer.Print List2.List(i)
Next i
Printer.EndDoc ' added
and this printed both text and graphic, but on separate pages. I'm not sure how to carry out your second suggestion.
MyFathersSon
|
|
|
|
|
That's what I was afraid of...
Been a long time since I messed with that. I wish I had a good example for you, but there should be a bunch of em out there (good ol' Google).
|
|
|
|
|
Thanks for your advice OldWarhorse. Not much on google.
|
|
|
|