|
Thank you guys.. would get back to after i try out this option..
cheers,
jagan
|
|
|
|
|
Hello folks,
The latest project involves a collection of large (multi-MB) images; I'm working on set of controls including an interactive thumbnail display and an image list; when the user selects an item in the list, a thumbnail is highlighted. When the user clicks a thumbnail, the corresponding item is selected in the list.
The problem here is that I load Bitmaps for each image, and then just draw them in a small rectangle. So I've got these huge hogging Bitmaps drawing in little spaces leading me to believe I'm wasting memory. Is there some way you can get a "low quality" thumbnail of a massive image file without loading the entire file into memory? "Skim" the file, or something like that.
If that is really difficult, is there a way I can load the huge files into memory only initially and just store them as tiny thumbnail Bitmap objects? Thanks!
--
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
If you load the images into memory and draw them into a smaller bitmap, then call the dispose method of the larger ones, that will do the trick. I dunno of an efficient way to read the file off disc and build a smaller bitmap, but I guess it may be possible. Scanning the file to build a smaller bitmap is easy, I just dunno how the disc access part would work, or if it would be faster to seek to individual bytes, as opposed to reading the whole thing in one go.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Just a thought:
Windows Explorer is able do create thumbnail display for most file types these days. If you can programmatically invoke the process, you will get the ‘thumbs.db’ file. Using some API you would be able to able to read it and show the thumbnails without wasting much resources. Search in this direction.
Second way: You can have a service which creates thumbnails for all files in a predefined folder, like google’s picasa. You can use a third party library to generate the thumbnails. I believe there are free libraries for this purpose. (ImageGear is a library I worked on, but its not free)
Hope this gives a direction.
|
|
|
|
|
Thanks both of you for the quick responses. Right now I'm going with the simpler answer from Christian . I'd rather do things full-out but who knows if the managers would agree...
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
I'm putting together something like the Snippet Compiler, and I am having fits trying to figure out how to add a .licenses file to the EXE.
It's sort of a "which came first, the chicken or the egg" problem.
Given a .licx file, I can use the lc.exe utility to generate a .licenses file. Then, I can use the /res: compiler switch to embed the generated resource.
BUT, you have to provide the .EXE file to the lc utility, which DOESN'T EXIST YET!!! Argh!
So, I'm thinking the approach is:
1. compile and generate the EXE
2. use lc to generate the .licx file
3. use al to embed the .licenses resource into the EXE
But I'm stumped on how to do step 3, or even if it's right!
Any ideas?
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
|
Nick Parker wrote:
Marc, I came across this article that might be helpful.
I already found that link yesterday, but thanks! It was quite helpful, but the problem is that the EXE already exists, so you have something to use for the /target: switch.
I'm hoping that I don't have to resort to compiling the entire assembly, then recompiling it with the /res switch after building the .licenses file.
And then, there's dealing with older style licensing that used a .LIC file--here VS does something yet again different, as the instructions for the component says that the .LIC file has to be in the same folder as the assembly you're linking against.
Oh, and to make matters even more interesting, if I use the /res: option to add my .licenses file, then another component (from DevExpress) all of a sudden says that IT is missing licensing information.
Good grief. What a nightmare. I wonder if MonoSharpDevelop has solved these problems.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
You don't need the compiled executable, only to specify the executable name. This helps name the .licenses file appropriately, nothing more.
Now, you would run into a problem if the control you wanted to license was in the .EXE in which you wanted to embed the .licenses file, but nothing that can't be overcome with a three-stage compilation like you outlined above.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Stewart wrote:
You don't need the compiled executable, only to specify the executable name.
Hehe. I just figured that out about an hour ago! Dang, I wish the documentation would have made this clear. I assumed from the description that the target had to exist!
Thanks!
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
I agree. targetPE makes it seem like the PE/COFF is required. Be sure to send feedback about that link. It actually does get read.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I've been working today on a metronome application in C#.
I'm using a System.Windows.Forms.Timer variable named "Clock" as my timer.
I've implemented basic tempo change functionality by means of a trackbar as follows.
private void tbTempo_Scroll(object sender, System.EventArgs e)
{
Clock.Interval = 60000/(tbTempo.Value);
}
I would now like to implement "accented beats". If a bar has 4 beats, I want the 4th beat to sound different from the preceding 3.
Put another way, the first three ticks result in, say, DrumNormal.wav being played and the next tick results in DrumAccent.wav being played.
This is repeated till the user presses the "Stop" button.
Could I get some tips on how I can implement this?
Thanks!
|
|
|
|
|
I think the modulus operator would work well for you in this situation. Without going into the details, if you have:
int result = someValue % 4;
Then result will be zero if and only if someValue is divisible by 4. I think you can use this information to build a solution to your problem.
|
|
|
|
|
Brian, thanks for your suggestion. It did, indeed, work very well!
private void Clock_Tick(object sender, EventArgs e)
{
count++;
if ((count % 4) == 0)
AccentBeatBuffer.Play(0,0);
else
NormalBeatBuffer.Play(0,0);
}
|
|
|
|
|
Hi All,
This is my first post in the C# section. Hope I get a reply.
In my windows form application I have a TreeView on the left side of a splitter control. Tree nodes can have 2 labels say, A and B.
If the user selects a node with A label on it, I want to show a form with some controls on the right side of the splitter.
If the user selects a node with B label on it, I want to show a different form with different controls on the right side of the splitter.
Can anyone suggest a method for form switching the way I want?
Please dont ask me to use only one form and show and hide controls depending on the tree node selection.
Your help will be much appreciated.
TIA
Binayak
|
|
|
|
|
|
You could have also used User Controls. They would have been easier to work with since they would have each been their own class.
|
|
|
|
|
How can I kill a running process with the Win32 api ? I know that I have to use a Process ID, but how can I resolve this one ? Thanks for each response.
|
|
|
|
|
You can do this through the .NET Framework, there is a Kill method defined in the Process class. Check into here: Process.Kill[^].
- Nick Parker My Blog | My Articles
|
|
|
|
|
Morning All -
I have a unix file / and Stream output that uses ^M [CTRL-M CR (Carriage return) ] to end a line. I see the line break's in MS Wordpad, but not in Notepad or when trying String.Split(char [], ...) I do not know what char to define.
Can anybody help, or point me in the right direction.
thx,
CJ
|
|
|
|
|
Are you writing the file or reading it? By default, TextWriter.NewLine is the same as Environment.NewLine . If you need to change this, you can set the NewLine property to any string necessary on classes that extend TextWriter (like StreamWriter ).
If you're reading files using classes extending the TextReader , many take an optional parameter (via overloads) to the control to automatically detect the file encoding, which most often checks the line-endings as well (IIRC). Take a look at the overloaded constructor documentation for the StreamReader class in the .NET Framework SDK for more information.
If you're wondering why wordpad.exe displays ^M it's most likely because it hasn't been updated to handle different line endings while notepad.exe has.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
Hi All!
I come from a VB background and have been doing .NET for a year or so, and am looking for a way to yield / update my GUI every now and then when doing long operations (the occational check for ESC-keys, mouseclicks, etc).
I guess I could do it with API's, but since many of the API's I used with VS6 is now integrated in the framework, I thought it was a solution to this too?!? I use Net2003 Framework 1.1.
Any gurus out there?;)
TIA
-Per
|
|
|
|
|
Bibl2Frogn wrote:
and am looking for a way to yield / update my GUI every now and then when doing long operations
You should look into threading. The Thread[^] class has more information, I would start there. There is also Application.DoEvents[^] which will process all messages in the message queue. This should get you started.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks Nick. I'll look into it.
-Per
|
|
|
|