Click here to Skip to main content
15,920,687 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Linq Where vs FirstorDefault Pin
BillWoodruff18-Dec-15 2:17
professionalBillWoodruff18-Dec-15 2:17 
GeneralRe: C# Linq Where vs FirstorDefault Pin
F-ES Sitecore18-Dec-15 2:24
professionalF-ES Sitecore18-Dec-15 2:24 
GeneralRe: C# Linq Where vs FirstorDefault Pin
BillWoodruff18-Dec-15 6:35
professionalBillWoodruff18-Dec-15 6:35 
QuestionMessage Removed Pin
17-Dec-15 2:12
Member 1221357217-Dec-15 2:12 
Questionhow can i improve these code's display efficient? Pin
smallkubi16-Dec-15 19:43
smallkubi16-Dec-15 19:43 
AnswerRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak17-Dec-15 2:20
mveDave Kreskowiak17-Dec-15 2:20 
First, your code leaks resources at an insane rate. Every time the Paint event is called you're creating a new Pen and not Disposing it. This will eventually cause Windows to crash.

Create the Pen once, outside the event handler and reuse it. Dispose it when your application closes.

Next, this runs slow because you're drawing 100 series on a chart! It wasn't really designed to do that and isn't optimized to handle that kind of a load.

Every time you move the mouse with the button down, the chart has to be redrawn to "unpaint" the rectangle that your painting and redraw the rectangle in its new position and dimensions. To make it worse, you only have one data point per series! The more points you add to search series the exponentially slower the painting will become.

The only solution you have is to not draw so many chart series.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: how can i improve these code's display efficient? Pin
smallkubi17-Dec-15 6:09
smallkubi17-Dec-15 6:09 
GeneralRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak17-Dec-15 6:21
mveDave Kreskowiak17-Dec-15 6:21 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi17-Dec-15 13:50
smallkubi17-Dec-15 13:50 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi18-Dec-15 6:24
smallkubi18-Dec-15 6:24 
GeneralRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak18-Dec-15 7:13
mveDave Kreskowiak18-Dec-15 7:13 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi18-Dec-15 18:16
smallkubi18-Dec-15 18:16 
GeneralRe: how can i improve these code's display efficient? Pin
Dave Kreskowiak19-Dec-15 4:43
mveDave Kreskowiak19-Dec-15 4:43 
GeneralRe: how can i improve these code's display efficient? Pin
smallkubi19-Dec-15 6:16
smallkubi19-Dec-15 6:16 
Questiondynamically create label Pin
Member 1048416216-Dec-15 11:38
Member 1048416216-Dec-15 11:38 
AnswerRe: dynamically create label Pin
Dave Kreskowiak17-Dec-15 2:10
mveDave Kreskowiak17-Dec-15 2:10 
AnswerRe: dynamically create label Pin
User 418025420-Dec-15 15:21
User 418025420-Dec-15 15:21 
QuestionUse variable in Powershell Pin
Alexduu16-Dec-15 3:12
Alexduu16-Dec-15 3:12 
AnswerRe: Use variable in Powershell Pin
Richard MacCutchan16-Dec-15 3:17
mveRichard MacCutchan16-Dec-15 3:17 
Questionflipkart seller api with .Net Pin
rajaramesh3615-Dec-15 16:40
rajaramesh3615-Dec-15 16:40 
QuestionUpdating of datagrid is not happening Pin
Member 1144944715-Dec-15 5:07
Member 1144944715-Dec-15 5:07 
GeneralRe: Updating of datagrid is not happening Pin
CHill6015-Dec-15 5:13
mveCHill6015-Dec-15 5:13 
GeneralRe: Updating of datagrid is not happening Pin
Member 1144944715-Dec-15 23:06
Member 1144944715-Dec-15 23:06 
GeneralRe: Updating of datagrid is not happening Pin
CHill6015-Dec-15 23:31
mveCHill6015-Dec-15 23:31 
GeneralRe: Updating of datagrid is not happening Pin
Member 1144944715-Dec-15 23:46
Member 1144944715-Dec-15 23:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.