Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 8:43
Ghydo1-May-11 8:43 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21081-May-11 9:50
Cadi21081-May-11 9:50 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 11:07
Ghydo1-May-11 11:07 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 0:26
Cadi21082-May-11 0:26 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Luc Pattyn2-May-11 15:10
sitebuilderLuc Pattyn2-May-11 15:10 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 23:36
Cadi21082-May-11 23:36 
Questioni need a help with an analog clock in c# Pin
stranger8030-Apr-11 9:54
stranger8030-Apr-11 9:54 
AnswerRe: hi Pin
Luc Pattyn30-Apr-11 10:14
sitebuilderLuc Pattyn30-Apr-11 10:14 
Hi,

welcome to CodeProject.

A few suggestions for starters: there is a nice message "How to get an answer..." somewhere high up on this page; I suggest you read it carefully. It will tell you to provide a better subject line, to format your code (by using PRE tags), and many other things all helping you to get more answers, resulting in better and earlier feedback.

I did not study all that code (as it isn't in PRE tags, you can still edit the existing message!) however I can tell you this:

1.
it isn't object oriented. You should never copy-paste a bunch of code just because you want two identical or almost identical things somewhere. That most likely gets handled by creating a class (=a set of code and data pertaining to a real-world object (or maybe something more abstract).

2.
Furthermore, an AnalogClock should be a class that inherits from UserControl, so you can turn it into a separate DLL file, making it available to all kinds of WinForms applications, just like the standard Buttons, Labels and all known Controls. I suggest you read up on UserControl, and maybe search for some CodeProject articles on analog clocks while you're at it.

3.
Controls (and other classes) can have Properties, that is how you would specify e.g. their location on a Form. Or their offset from GMT (their time zone).

4.
there are more elegant ways to draw the digits, a for loop driven by a coordinates array comes to mind. Anything would be better than a sequence of
gr.DrawString("12", textFont, solidbrush, 109, 40);
gr.DrawString("11", textFont, solidbrush, 75, 50);
gr.DrawString("10", textFont, solidbrush, 47, 75);
...


5.
When you create drawing objects such as Fonts, Pens, Graphics, etc, you should clean up after yourself (yes, the GC does that also, however it does it late, and graphics objects can be expensive). So check if the class has a Dispose() method, and if it does, use it.
There are two alternatives:
- create those objects once, and keep them around as class members inside your AnalogClock class;
- or use a using statement (read up on it, it is perfect for these kinds of things).


There may be more, however that should get you started in the right direction.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: hi Pin
stranger8030-Apr-11 10:30
stranger8030-Apr-11 10:30 
QuestionHow do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_30-Apr-11 6:59
_Q12_30-Apr-11 6:59 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Dave Kreskowiak30-Apr-11 10:04
mveDave Kreskowiak30-Apr-11 10:04 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen30-Apr-11 22:13
professionalEddy Vluggen30-Apr-11 22:13 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_5-May-11 8:26
_Q12_5-May-11 8:26 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen5-May-11 9:21
professionalEddy Vluggen5-May-11 9:21 
QuestionUsings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:28
professionalrms12330-Apr-11 2:28 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 2:39
Philippe Mori30-Apr-11 2:39 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:45
professionalrms12330-Apr-11 2:45 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 2:56
Philippe Mori30-Apr-11 2:56 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 3:02
Philippe Mori30-Apr-11 3:02 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 [modified some more] Pin
Luc Pattyn30-Apr-11 2:46
sitebuilderLuc Pattyn30-Apr-11 2:46 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:54
professionalrms12330-Apr-11 2:54 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Luc Pattyn30-Apr-11 2:59
sitebuilderLuc Pattyn30-Apr-11 2:59 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 3:20
professionalrms12330-Apr-11 3:20 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
PIEBALDconsult30-Apr-11 3:37
mvePIEBALDconsult30-Apr-11 3:37 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Luc Pattyn30-Apr-11 4:08
sitebuilderLuc Pattyn30-Apr-11 4:08 

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.