|
I have DataGridView in virtual mode containing 3500 rows.
In code below, assigning to RowCount value to 3500 takes 8 seconds.
CPU usage goes high at this time.
Stepping by F11 into user code shows few celltemplate property getters and
combobox/datecombo constructor calls without database access which does not
take a lot of time.
Debug output (below) shows lot of messages Stepping over non-user code.
Running in release mode from Windows this line speed is same (slow).
How to speed up grid creation ?
Using C# Express 2008 3.5 SP1 in Vista.
class Grid : System.Windows.Forms.DataGridView {
internal void SetDataRetriever(DataRetriever<TEntity> dataRetriever)
{ ......
SuspendLayout();
Enabled = false;
int cnt = DataRetriever.RowCount + (ReadOnly ? 0 : 1);
RowCount = cnt;
Enabled = true;
ResumeLayout();
}
protected override void
OnCellValueNeeded(DataGridViewCellValueEventArgs e)
{
if (!Enabled)
return;
...
}
protected override void OnRowEnter(DataGridViewCellEventArgs e)
{
if (!Enabled)
return;
...
}
}
Debug output window contains:
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.RowCount.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DataGridViewComboBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.FlatStyle.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DisplayStyleForCurrentCellOnly.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewColumn.CellTemplate.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DataGridViewComboBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.FlatStyle.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DisplayStyleForCurrentCellOnly.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.CompleteCellsCollection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.RowTemplateClone.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRowCollection.Add'
Step into: Stepping over non-user code
'System.Windows.Forms.Control.Enabled.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.OnRowEnter'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.SetCurrentCellAddressCore'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DataGridViewComboBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.FlatStyle.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DisplayStyleForCurrentCellOnly.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.DataGridViewTextBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.PropertyStore.GetObject'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewCell.Style.get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewTextBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DataGridViewComboBoxCell'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.FlatStyle.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.DisplayStyleForCurrentCellOnly.set'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewComboBoxCell.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.CloneCells'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRow.Clone'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRowCollection.this[int].get'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.SetSelectedCellCore'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.SetSelectedElementCore'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.ClearSelection'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridView.OnRowCollectionChanged_PostNotification'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRowCollection.InsertCopiesPrivate'
Step into: Stepping over non-user code
'System.Windows.Forms.DataGridViewRowCollection.Add'
Andrus
|
|
|
|
|
I'm trying to make an FTP program in C#. The only class to use in C# is FtpWebRequest.
For each connection I start a new thread which opens the FTP connection and uploads or downloads.
But when finishing the upload routine and testing it, it seems FtpWebRequest only handles 2 connections, a 3rd or 4th upload hangs in the GetRequestStream function.
I tried setting the ServicePoint.ConnectionLimit to 4 but that doesn't help and I can't find any other methods of changing this apparent connection limit.
It's not a problem of the ftp server I connect to, because other ftp programs can do more than 2 connections to that server. I even set the MaxConnectionsPerServer keys in the registry (on this pc and the server, allthough I believe these are meant for http download connections, not ftp, but I'm thinking maybe FtpWebRequest isn't true ftp ?)
And apparently I'm the only one with this problem, cause I cannot find any mention of this on google.
Anybody got any ideas ?
Oh, and by the way, its pretty slow too, is that a known issue ?
|
|
|
|
|
That is a builtin OS limitation.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Could you elaborate ? is this documented somewhere ?
If you mean the maxconnectionsperserver key in the registry, I already increased it and it doesn't help.
Besides like I said, other ftp programs can do a lot more connections, so that would mean ftpwebrequest is not real ftp.
|
|
|
|
|
quorton wrote: Could you elaborate ? is this documented somewhere ?
I dont know where it is documented. It is a well known fact.
quorton wrote: I already increased it and it doesn't help.
Do you not understand LIMITATION? In others words, there is nothing you can do about it.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Maybe he's been on one of those self-help courses where they tell you to accept no limitations.
|
|
|
|
|
Yes I do understand limitation, and if its such a wellknown fact then why isn't there any mention of it anywhere ?
|
|
|
|
|
5ed to counter the vote of crybaby monkeyboy.
|
|
|
|
|
hi
how can i run default dial up internet connection in windows with c#?
i searched google and MSDN but i couldn't find a simple way . plz help me .
thank you in advance .
modified on Sunday, October 26, 2008 2:31 PM
|
|
|
|
|
use wininet API
see wininet csharp[^]
and there many third party component out there
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi,
I want to know how can I get list of contacts in GAL (Global Address List) from the Microsoft Exchange using C#?
Thanks,
|
|
|
|
|
I've used this walkthrough before.
|
|
|
|
|
eddyvluggen wrote: I've used this walkthrough before.
Error on page.
|
|
|
|
|
|
ASALAMOALEKUM All,
I am facing problem while retrieving frequency of an audio per second.
I am using DirectX's libraray "Directsound", and its giving same value throughout the complete audio and i dont know why even i have placed the function in timer_tick event which updates after each second!
i am pasting my code below.. please if anyone can help me (immediate help is required), i would be very thankful coz my whole further work depends upon it.
if anyone thinks; this way i couldnot retreive per second frequency, if u can please do suggest me any other library... (Basically my task is to index video scenes on the basis of audio)
waiting for reply!
regards,
SANA
$@N@
|
|
|
|
|
sorry i forgot to pastre my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.DirectSound;
using DS = Microsoft.DirectX.DirectSound;
public partial class Form1 : Form
{
private DS.Device sounddevice;
private SecondaryBuffer shotsound;
BufferDescription description;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
sounddevice = new DS.Device();
sounddevice.SetCooperativeLevel(this, CooperativeLevel.Priority);
description = new BufferDescription();
description.ControlFrequency = true;
shotsound = new SecondaryBuffer(@"D:\fiese-lache1.wav", description, sounddevice);
shotsound.Play(0, BufferPlayFlags.Default);
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = shotsound.Frequency.ToString();
}
}
regards,
SANA
$@N@
|
|
|
|
|
I am not sure whether shotsound.Play will let further processing to take place. I mean like whether it Plays the wav file in a seperate thread. If it doesn't it means that timer1 doesn't start until the sound stops playing. So maybe you can try something like this...
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
...<br />
<br />
timer1.Start();<br />
shotsound.Play(0, BufferPlayFlags.Default);<br />
}<br />
<br />
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
if(shotsound != null)<br />
label1.Text = shotsound.Frequency.ToString();<br />
}<br />
If it doesn't work, play the wav file in a seperate thread.
-------------------------------------------
It's code that drives you - Shyam
|
|
|
|
|
Why are you expecting the sample rate of a wav file to change as it is played?
If you want the frequency(s) of the sound in the file then you'll have to look into fourier decomposition (look for an fft library).
|
|
|
|
|
Hey!
I'm trying to make a control which relies somewhat on tabs to display different panels, so at runtime controls can be added to each individual panel. I just can't figure out how to allow the tabs to be selected at designer time to display a different panel in correspondance.
A prime example would be the TabControl, where you can click a tab and a different panel in relation to the tab is displayed, so you can keep switching. I do have a property set for my control to adjust the ActiveTab digit to flick through the panels manually (by typing), but i'd much prefer to have the panels switching by having the tabs themselves selected at designer time.
If anyone can help, thanks in advance
Edit: I also set the panel controls to Control.Visible = false; in the code, but the *all* the controls are still displayed in the designer, so is there any way selectively hide panels in the editor until a particular tab is selected? Thanks
|
|
|
|
|
Hey Folks;
I was lucky enough to get a new development box. I have loaded 2008 server 64-bit as the OS, SQL 2005 64-bit SP-2. 8g of memory and a terabyte of disk space.
I downloaded the 64-bit SMO files from MS.
I am using VS2008.
This code used to be really fast on my old XP 32-bit machine and I have not changed the code but now it takes forever to find the db servers in my net.
Does anyone have any insight to this.
here is the code..pretty standard stuff I think.
{
Cursor.Current = Cursors.WaitCursor;
DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
if (dt.Rows.Count == 1)
cmbServers.Text = (dr["Name"].ToString());
Console.WriteLine(dr["Name"]);
cmbServers.Items.Add(dr["Name"]);
}
}
Cursor.Current = Cursors.Default;
}
Thanks in Advance for any Help
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
If it's a new machine, I would guess that you've got some configuration problems. I made a similar move (32-bit XP to 64-bit XP), and none of my code runs any slower than it did before.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello All ,
I have a Matrix which transforms the Graphics object during the OnPaint event handler to "zoom in/out" of a Panel that I have depending on this matrix.
I want to Invalidate() a specific region that is of absolute coordinates (relative to the control though). When the OnPaint method is called, I want to be able to set the transformation on the Graphics object and then paint a rectangle around the e.ClipRectangle region. Here's the problem: when you perform Graphics.DrawRectangle for the ClipRectangle AFTER it has been transformed, the rectangle is transformed and is now RELATIVE to the transformed Graphics object (and therefore translated and resized by the zoom scale). How can I transform the ClipRectangle such that it is the "same size and location" as the absolute rectangle? I basically want to inflate/deflate it depending on the zoom. This is so that it can be drawn and used to perform hit testing AFTER the transformation. I have several "shapes" that I want to make sure are INSIDE of the invalidated region, but the only way to do this is to transform the ClipRectangle .
I know this is a bit confusing so if you need more explanation, let me know.
Cheers!
|
|
|
|
|
Hi All,
I want to compress Image to maximum rate, what the best Algorithm can I use?
If any one have a class to do that, please give me it ?
Ala Qunaibi
|
|
|
|
|
Depends on the content of the image and the type of compression you like to have:
- lossy or lossless
- picture has few distinct colors (like a comic) or is a photograph
For photos, you should choose jpeg or some wavelet based algorithms like jpeg2000.
Both offer lossy and lossless compressions, although the lossy ones work pretty well for photographs, but look a bit ugly with high compression ratios (you will get lots of artifacts).
For pictures with only a few colors, you can choose the palette based GIF (up to 255 colors) or PNG for images with more colors. PNG offers lossless compression.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks,
My Images are Photos and Compression type is lossless.
Can You help me , where can I find source code about What you said, or Examples?
Ala Qunaibi
|
|
|
|