|
To retreive a thumb of a jpg, reading the complete image file shouldn't be neccessary because a jpg file often has a thumb built in. GetThumbailImage() below is useless because the full image has to be loaded first. Any way around loading the full image file?
Bitmap myBitmap = new Bitmap(strImgLoc);
Image myThumbnail = myBitmap.GetThumbnailImage(100, 80, null, IntPtr.Zero);
Cheers,
Glenn Rogers
|
|
|
|
|
Travelster wrote:
reading the complete image file shouldn't be neccessary because a jpg file often has a thumb built in.
Not in any .JPG's I've seen. The thumb has to be created from the full size image.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello, Sir and Madam.
When drag a table from Server Explorer and drop it to a form The VS.net auto create InserCommand, DeleteCommand, UpdateCommand include with Parameters.
I need to imitate this in my application. Is it possible?
Thank You.
Sorry For Bad English
|
|
|
|
|
Yes. you can also do the same stuff here in your code and can call Adapter Update method to update back to your database.
Just have a look at Command builder calss .
Otherwise you can also create your own update,delete,select and insert commands using Command class and can assign it your DataAdapter.
Eg:
YourDataAdapter.SelectCommand=YourSelectCmdBuyer;<br />
YourDataAdapter.InsertCommand=YourInsertcmdBuyer;<br />
YourDataAdapter.UpdateCommand=YourUpdateCmdBuyer;<br />
YourDataAdapter.DeleteCommand=YourDeleteCmdBuyer;
Please have a look at MSDN for more information.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
http://www.west-wind.com/presentati...WebServices.asp
i made the sample web service studying from the above link
it was running correctly
after that i made the client that also from studying from the above link i add reference to webservice
let it be service1
after that it is written to add in class header
using service1;
i am not understanding where to add this abovw line
using service1
plz help
ankit
|
|
|
|
|
I need to send a “large” packed of data over TCP/IP using Socket. The data is an Bitmap image and is size is about 50.000 bytes. My problem is that Socket only transfer some of it and then stops.
I guess I need to transfer it in smaller blocks of data and then assemble is when I receive it. Can someone give me a hint on how to do this?
|
|
|
|
|
|
As a side project, I'm rewriting an incomplete debugging tool over to C#. It's nothing more than a fancy RS232/serial port terminal program that displays all text received on the port. The part I'm pondering though, is how to display the incoming text. I'd like to:
- Colorize the text
- Display only X amount of lines. If another line comes in, toss the oldest ones out
- Autoscroll as new lines come in
- Be able to split the display and scroll over the same data
So I can do all this with a Textbox (RichTextBox to be exact), but a couple of things concern me, mainly to do with the fact that the textbox stores the text internally. Splitting the window requires using two textboxes, which would require duplicating the data. With alot of ports open, that could be alot of wasted ram. Second, to ensure only X lines are stored, it looks like I have to grab the data out of the textbox (copying it), remove the oldest lines manually, then replace the text in the box (another copy). Twice, since the window is split. That seems pretty inefficient.
I've looked all over and have't seen any text control that will work without having its own copy of the data. I could write my own, but that's a fair amount of effort as well. Does anyone out there know of one that can be databound and not require copying so much? Or am I just missing something in how the textbox works? This has to be a pretty common scenario so I'm a bit suprised I have not been able to find much info on it..
|
|
|
|
|
what about listView control
ByMindOnlyYouCanDoIt
|
|
|
|
|
I would suggest you start thinking about writing your own. A few ideas:
1. Your UserControl holds the data in an array of string s, with a pointer to the "first line" (a circular queue). When a new line arrives, replace the current first line and increase the pointer. When you get to the end of the array, set it back to 0 (for the beginning.)
2. Create a Panel that draws the information in that array, without duplicating it. It should allow scrolling, coloring of text and everything else you need.
3. Add a Splitter as a child of your UserControl , and two of the Panel s created in #2.
I don´t think it would be as hard as it seems. Probably #2 is the hardest part.
Good luck, and if you do something reusable, think about writing an article for CP!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Yeah, that's where it looks like I need to head. I've gone so far as to disassemble the TextBox code to see if I could bypass anything there. It looks like it wouldn't be too much trouble to derive a class from TextBox that would let me at least read the text directly, but I don't see any way to get around the need to create a new string and put it into the textbox. With a 5,000-line buffer, making a copy of the entire textbox even once every time I want to update the contents seems very very inefficient. It's just a shame that I have to rewrite so much functionality. I'm still suprised that I can't find anything else out there that does this, it makes me wonder what I'm missing...
I thought about the ListView as well.. but cut-and-paste becomes difficult to do there, since I wnat to be able to cut-and-paste like a normal textbox.
Thanks for the thoughts! If I do end up with something usable I'll definately post it here!
|
|
|
|
|
My solution didn't include deriving from a TextBox but writing your own drawing code. But if you need text selection, and copy/paste support, definitely derive from a TextBox .
I don't know if the TextBox makes a copy of the string you use to set its Text property, or just keeps a reference (I'd think it makes a copy). To automatically scroll the text box to the end, set the cursor position at the very end, and done )I don't remember the exact properties). And for the bottomless buffer, you'll still have to make a circular queue as I described in my other post.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
i have 2 combobox's in my datagrid i created 2 class's one for combobox "ID", combobox "name"
each one is sorted "Ascending" so the indexing is not matching.
to solve this problem is to write a query to database and get the matching seleted ID and vise versa.
coz i created a class for combobox, how can i write a code to pass the selected item from class ID to myform, or ............
can i override events of combobox class from myForm !!!!!
i used combobox class from this site
http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx
thx
|
|
|
|
|
You can (in youe clas of ID)
write this : in the class level
private string SelItem;<br />
public string SelItemPro<br />
{<br />
get{return this.SelItem;}<br />
<br />
}
and then in the event of the item changed
private void ItemChanged_cb1(object sender,EventArgs ...)<br />
{<br />
this.SelItem = combobox.selectitem.ToString();<br />
}
and therfore as it is a public member u can acces it from your Form from the properties of the combo box
ByMindOnlyYouCanDoIt
|
|
|
|
|
Hi,
I got a quick question : Is there any way to store Maximimze/Minimize Size and Location of form in Registry?
So upon restart - it would read those values from registry and return to its former state
thanx in advance
|
|
|
|
|
why would you do this, in the application it self you can set the size properties and then in each restart of the application it will be at the same size of that you choosed
and also you can set it to sonstant size and set the FormBorderStyle property
to FixedSingle or Fixed3D to make no one has the ablity to change the size
while also when doing this you can make him has the ability to MAXIMIZE to the screen coordinates only
ByMindOnlyYouCanDoIt
|
|
|
|
|
Check the Registry class.
|
|
|
|
|
As it was suggested, check the Registry class.
Just take into account that you have to store the restored position, as well as the state (maximized, minimized or restore.)
You have to save the restored position before the window is minimized or maximized, because when minimized it is moved off-screen. You can do this in the SizeChanging event.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Lets say that I want to send a jpg from one computer to another. The only way I've found to send files is to convert the data into a byte and then send it across a socket; however, when the file has data that can not be handled within a byte, the new file is corrupted.
So, how do you send a file to another computer if the file contains data outside of a byte?
|
|
|
|
|
What do you mean "not compatible with a byte"? When you convert the file (jpeg or other), you should be converting it to a byte array (byte[], not byte) using some form of serialization such as binary serialization (see BinaryFormatter class), then (most likely) writing the resulting byte array to a stream.
I've had no trouble serializing files and storing the resulting byte arrays in databases, transferring over sockets, etc.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Thanks for the tip. I'm working on serialization right now.
|
|
|
|
|
Yay. I just made a file go from serialization to byte[] form. Thank you so much, bro.
|
|
|
|
|
Heyas all,
I was hoping someone could give me a hand with a problem.
I have an external file that holds location information on a user defined amount of places (the user can add or remove locations that can be chosen from.) I was making the file format like so:
-name;address;cross_streets;last_visited
What I need to do is to randomly choose a location on an event. The information would then be shown in a read only textEdit but formatted differently with each attribute (name, address, etc.) being on it's own line.
So I was thinking that on program start to load each line of the file into some sort of collection.
Could anyone give me any clues or a push on how to go about doing something like this? Is there an easier way than to load it into a collection? Am I way off in my design?
Thanks,
John
|
|
|
|
|
There are many ways you could go about this, and no way to cover all the bases in a practical reply.
If you're not tied to the existing file format, you might consider using XML. If you're not tied to using the file system, you might consider using a database, etc.
Assuming you want to stick with the current system, then you should probably use a FileStream and some flavor of StreamReader to read individual lines from the file (assuming logical records are separated by Newline characters), then you could use the String.Split(char) method to get a string array of the elements on each line, and go from there.
A couple of the benefits of using XML are flexibility and readability. You'd potentially have a little easier time changing the data you're storing, allowing for nulls or empty values or whatever.
You might also want to consider creating a structure or a class to hold the individual data elements that comprise a location (name, address etc.) - you'll probably want a class as the size of your type is likely to exceed 16 bytes (best practices limit on struct sizes since they're allocated on the stack), and you may also choose to investigate implementing your own custom collection of location objects (see CollectionBase for ideas).
Hope this is sufficient to get you started.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
hi,
how can i design my own window with c#? i want to change the look of the window, the functionality should be the same like a regular window. does anyone know how to do this or a helpful link?
thanks for help
|
|
|
|