Click here to Skip to main content
16,004,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor24-Aug-20 23:22
Exoskeletor24-Aug-20 23:22 
GeneralRe: How to calculate in c# the possibility of this game Pin
trønderen26-Aug-20 0:50
trønderen26-Aug-20 0:50 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor23-Aug-20 19:23
Exoskeletor23-Aug-20 19:23 
QuestionHow do I load a block on a form at startup Pin
Brian_TheLion22-Aug-20 18:56
Brian_TheLion22-Aug-20 18:56 
AnswerRe: How do I load a block on a form at startup Pin
BillWoodruff22-Aug-20 19:12
professionalBillWoodruff22-Aug-20 19:12 
AnswerRe: How do I load a block on a form at startup Pin
OriginalGriff22-Aug-20 20:48
mveOriginalGriff22-Aug-20 20:48 
GeneralRe: How do I load a block on a form at startup Pin
Brian_TheLion23-Aug-20 14:33
Brian_TheLion23-Aug-20 14:33 
AnswerRe: How do I load a block on a form at startup Pin
Luc Pattyn23-Aug-20 2:49
sitebuilderLuc Pattyn23-Aug-20 2:49 
Use the Paint handler, it is the only place where drawing ever should occur.

Avoid calling CreateGraphics, it is an expensive operation. The Paint handler gives its Graphics for free, see the PaintEventArgs that comes with it.

For all those small but disposable objects (Pens, Brushes, Fonts, ...) consider NOT creating them all the time by either:
- using the pre-existing ones, e.g. Pens.Red, Brushes.Red, etc.
(and since you didn't create those, you are not supposed to dispose of them either);
- creating your own, possibly more specialized ones (e.g. a thicker Pen) but then create them only once and keep them alive in class variables; when doing so, there is no need to dispose of them when your program exits.

Smile | :)
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...

AnswerRe: How do I load a block on a form at startup Pin
Gerry Schmitz23-Aug-20 6:48
mveGerry Schmitz23-Aug-20 6:48 
GeneralRe: How do I load a block on a form at startup Pin
Brian_TheLion24-Aug-20 17:03
Brian_TheLion24-Aug-20 17:03 
QuestionCreating a Windows form program using C# 8.0 Pin
Brian_TheLion22-Aug-20 20:30
Brian_TheLion22-Aug-20 20:30 
SuggestionRe: Creating a Windows form program using C# 8.0 Pin
Richard MacCutchan22-Aug-20 21:05
mveRichard MacCutchan22-Aug-20 21:05 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion23-Aug-20 0:34
Brian_TheLion23-Aug-20 0:34 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Richard MacCutchan23-Aug-20 2:00
mveRichard MacCutchan23-Aug-20 2:00 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Dave Kreskowiak23-Aug-20 4:07
mveDave Kreskowiak23-Aug-20 4:07 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion23-Aug-20 14:30
Brian_TheLion23-Aug-20 14:30 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Dave Kreskowiak23-Aug-20 18:38
mveDave Kreskowiak23-Aug-20 18:38 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 16:55
Brian_TheLion24-Aug-20 16:55 
AnswerRe: Creating a Windows form program using C# 8.0 Pin
Mycroft Holmes23-Aug-20 12:22
professionalMycroft Holmes23-Aug-20 12:22 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 16:57
Brian_TheLion24-Aug-20 16:57 
AnswerRe: Creating a Windows form program using C# 8.0 Pin
Richard Deeming23-Aug-20 23:11
mveRichard Deeming23-Aug-20 23:11 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 17:01
Brian_TheLion24-Aug-20 17:01 
Question{Solved} Find and count duplicates in a list Pin
Acuena20-Aug-20 2:51
Acuena20-Aug-20 2:51 
AnswerRe: Find and count duplicates in a list Pin
OriginalGriff20-Aug-20 3:38
mveOriginalGriff20-Aug-20 3:38 
GeneralRe: Find and count duplicates in a list Pin
Acuena24-Aug-20 4:16
Acuena24-Aug-20 4:16 

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.