|
Right click anywhere in the editor, and select "Collapse to Definitions" from the Outline submenu to collapse all.
To expand all, select "Stop Outlining" from the same menu.
|
|
|
|
|
I want this feature in Richtextbox
|
|
|
|
|
Hello to All,
I have to take input from mic as a wav formate stream. How can i do this with C#. Can anybody know about this plz help me with example code if you have.
Divyang J Mithaiwala
|
|
|
|
|
|
Use the RichTextBox class.
<br />
RichTextBox r = new RichTextBox();<br />
r.LoadFile(@"C:\Document.rtf", RichTextBoxStreamType.RichText);<br />
r.SaveFile(@"C:\Document.txt", RichTextBoxStreamType.PlainText);<br />
r.Dispose();<br />
|
|
|
|
|
Hello,
When COM structures are imported into C# remoting server, is there a simple way to make structures serializable? The idea is to use same structures on native and managed components.
Thank you & Best Regards,
|
|
|
|
|
hey ....i wanna know something...first my project about face recognition system...so i used eigen face algorithm so i need to convert from matrix (100*150) to vector so i need to convert to vector ,how could i ???
thanks for efforts
|
|
|
|
|
|
Is your question about converting a matrix to a vecotr?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
|
You have to be more precise, as I don't want to learn the EigenFace algorithm to help you.
Is your matrix a colletion of vectors? Do you want to convert to a normal?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
ok ....look i'll explain briefly ...first i have an image (100*150)and i have about 15 training images so i need to change every image to one vector and collect all 15 images in one matrices so i'll have one matrices inside it 15 vectors for all 15 images .....ok .....hope now u know what i mean thanks for your efforts
|
|
|
|
|
I am trying to iterate through a list of public attributes of an object. I can get the list from using the Type object. Like the following.
DataColumn dc = dbSet.Tables[ParID].Columns[ID];
Type dcType =(typeof(DataColumn));
PropertyInfo[] pi = dcType.GetProperties(
BindingFlags.Public|BindingFlags.Instance);
By iterating through pi I can get the name of the properties and the data type, but I can't seem to figure out how to go back to dc and get the value for that property. What am I missing? Is there an easier way to get this information, when you really don't know all the available attributes of an object? I can't find anything that links these two together in the MSDN or anywhere else.
Thanks for your assistance.
Leo T. Smith
|
|
|
|
|
You can use the GetValue method on a PropertyInfo object:
object value = pi[someIndex...].GetValue(dc, null);
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Thanks, this was what I was missing. It worked great.
Leo T. Smith
|
|
|
|
|
I have some image preview control based on a Panel which remembers current preview image position. Its OnPaint method does nothing except drawing viewed part of the image using this DrawImage override:
Graphics.DrawImage(Image, Rectangle, Rectangle, GraphicsUnit)
This draws only desired part of an image. The preview control is very small, so the whole painting should be fast, but it isn't.
Drawing 50x50 px rectangular part from one image to second - for some unknown reason - depends on the size of the source image When this method draws little rectangle from 7 Mpx image, it tooks about 200 ms - that's not real-time, when image is moved and the control is repeatedly invalidated.
I saw similar preview controls, where the scrolling of image were smooth and doesn't depend on image size. These controls were part of the MFC apps. Then I tried professional .NET component for image previews, which was also slow. I'm confused - why can't this simple task be quick?
I spent a life solving this problem, so answer would be appreciated.
|
|
|
|
|
Here are some possible suggestions i've encountered with similar Stuff:
- Is the OnPaint method called very often? (stupid thing i once did number 1 )
- Try using a label instead of a panel. A label is double-buffered (if i remember right) and a panle isn't. Better yet, make your own custom control with the styles DoubleBuffer, AllPaintingInWmPaint and UserPaint on.
- Make sure the source rectangle and the destination rectangle are the same width and height, so the GDI doesn't have to schale the screen image.
- It can also be a problem as a result of the big image (i think 7 MB is a lot). If it's possible, try drawing a bitmap with a pixel format of Format32bppPArgb, it is said to be the fastest.
I hope this helps!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
In addition to what Marc said...
Instead of redrawing the image from the same 7M pixel image (huge!), have your control draw the thumbnail image to an internal buffer first, the same size as the preview window. Then when your preview has to draw, it can more quickly draw it from the internal buffer version, which should be pretty small.
I've had to do this a few times in some custom controls that I wrote. Instead of calculating the same image over and over again in order to redraw a control image that doesn't change much, I monitor the Resize events of my control and redraw the control image to an internal buffer. Then in the Paint event for the control, I draw the control image from the buffer.
For example, take a clock face. Most of what you see doesn't change, except for the hand positions. But, to get smoothly turning clock hands, you have to redraw the control about every 30-50 ms at least. Since calculating the positions of the various bits of a clock face can be time consuming, a clock face image should be calculated and drawn once to a cached image. When the control has to redraw itself (every 30ms), it merely has to draw the clock face from the cache, then calculate and draw only the hand positions. When the size of the control changes, you recalculate and redraw the cache image to match the size of the control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In fact, I'm afraid that using buffer will enhance redrawing when image position doesn't change, but when user will need to shift image viewport by a "hand tool", the redrawing buffer with drawing it on control will take slightly more time than redrawing the control directly. However, the buffer idea is good, because there can be more OnPaint calls, not only on mouse moves...
Another idea was to use a three times larger buffer than the control. When user drags mouse over control, the cursor is locked inside the control bounds and OnPaint works just with the buffer. When user releases mouse button, the buffer will update. This can be a little frustrating, when user needs to scroll whole large image (more dragging), but this can be also fast.
I'll try these approaches, thank you very much for the new ideas .
|
|
|
|
|
ltinka wrote:
Another idea was to use a three times larger buffer than the control. When user drags mouse over control, the cursor is locked inside the control bounds and OnPaint works just with the buffer. When user releases mouse button, the buffer will update. This can be a little frustrating, when user needs to scroll whole large image (more dragging), but this can be also fast.
Instead of tieing the user to a small section of the image per move, if they reach the edge of the bufffer cause an update then. A periodic delay would be much less bothersome for the user than having to repeatedly grab and let go to scroll a large distance.
|
|
|
|
|
I'm running an app that creates several hundred thousand files and directories. After it runs a few hours the system runs out of resources. I've tracked the problem own to a lack of PTEs.
When I googled this I saw responses on how to change registry settings to create more PTE space but this won't work for two reasons.
1) The number of files can be arbitrarily large.
2) This is a consumer product and I can't expect the consumer to tweak the registry.
Has anyone else seen this problem or have an idea what is going on?
|
|
|
|
|
This doesn't really make any sense. PTE are used by the Virtual Memory Manager. This shouldn't affect the number of files/folders you create on a volume.
Are you looking at a memory or handle leak perhaps?
You could increase this pool, but your app would have to modify the registry (preferrably during installation) and restart for the changes to take effect.
I'd test the crap out of this solution though. By increasing the PTE pool, you could be merely postponing the inevitable because of leaky code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I originally discovered what was causing my problem by doing a !vm in the kernel debugger. There was no problem with virtual memory except for an upper-case message: "YOU ARE OUT OF PTES".
I know that my handles are ok. Both the task manager and the openfiles command verify it.
In my original message I said I was creating hundreds of thousands of files. I was mistaken. I am actually creating millions of files, each about 256 kbytes. I structured the directories so that there are no more than 10,000 files per directory.
I also forgot to say that I am using interop from C# to do normal CreateFiles and WriteFiles from C. Also, I am doing the reads from a volume snapshot in xp sp2.
I did a test of running my code with the actual file-writing disabled and had no problem. All I can figure is that this is a bug in windows when you write too many files. I guess I will have to change my design to reduce the actual number of files written.
|
|
|
|
|
Well, the limit of the number of files in a single NTFS volume, depending on disk size of course, is 4.294 Billion. On a FAT32 volume, it's 4.17 Million. It's not a bug in Windows, but a problem with I/O capacity and the fact the you're probably one of the few people on earth to generate this many files on a volume. God help you if CHKDSK ever has to run. I hope you can take a week off...
It is recommended that, on volumes that contain an excessively large number of files, and Millions qualifies, that you go through this[^] document on MSDN. Disable 8.3 name generation and also turn off Last Access timestamp updates. You'll probably have to do more than that...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I wanted to know if given an ip range, i.e 192.168.1.0-192.168.0.255, how do I find out which IPs are actual machines connected to the LAN without having to ping each IP?
Even if I ping each IP, I wouldn't know if a timed out IP is an actual machine connected the network but offline or if the IP doesn't even exist on the LAN.
If anyone has used the program Look@Lan, they would know that when you input an IP range it automatically figures out which IPs are valid and discards the ones that don't exist on the LAN. How do I accomplish this using C#?
I'm using Visual Studio .NET 2005 with framework 2.0.
I would appreciate any help or advice.
Thanks.
|
|
|
|