Click here to Skip to main content
15,904,926 members
Home / Discussions / C#
   

C#

 
GeneralRe: Activator.CreateInstance Pin
scotlandc28-Jun-11 21:16
scotlandc28-Jun-11 21:16 
GeneralRe: Activator.CreateInstance Pin
BobJanova28-Jun-11 22:29
BobJanova28-Jun-11 22:29 
GeneralRe: Activator.CreateInstance Pin
scotlandc28-Jun-11 23:28
scotlandc28-Jun-11 23:28 
Questionhow can I retrieve values ​​from a textBox in another screen after the user set / send it Pin
aspkiddy28-Jun-11 2:42
aspkiddy28-Jun-11 2:42 
AnswerRe: how can I retrieve values ​​from a textBox in another screen after the user set / send it Pin
Not Active28-Jun-11 2:49
mentorNot Active28-Jun-11 2:49 
GeneralRe: how can I retrieve values ​​from a textBox in another screen after the user set / send it Pin
marszheng28-Jun-11 15:03
marszheng28-Jun-11 15:03 
GeneralRe: how can I retrieve values ​​from a textBox in another screen after the user set / send it Pin
Not Active28-Jun-11 15:45
mentorNot Active28-Jun-11 15:45 
AnswerRe: how can I retrieve values ​​from a textBox in another screen after the user set / send it Pin
BobJanova28-Jun-11 22:33
BobJanova28-Jun-11 22:33 
QuestionProblem with reteriving xml data from sql data base. Pin
prasadbuddhika28-Jun-11 0:23
prasadbuddhika28-Jun-11 0:23 
AnswerRe: Problem with reteriving xml data from sql data base. Pin
abhinish28-Jun-11 0:35
abhinish28-Jun-11 0:35 
QuestionProblem with Process.HasExited Pin
Nigel Mackay27-Jun-11 23:52
Nigel Mackay27-Jun-11 23:52 
AnswerRe: Problem with Process.HasExited PinPopular
BobJanova27-Jun-11 23:55
BobJanova27-Jun-11 23:55 
GeneralRe: Problem with Process.HasExited Pin
Nigel Mackay28-Jun-11 0:08
Nigel Mackay28-Jun-11 0:08 
QuestionCode style [modified] Pin
Lutosław27-Jun-11 23:43
Lutosław27-Jun-11 23:43 
AnswerRe: Code style Pin
V.27-Jun-11 23:50
professionalV.27-Jun-11 23:50 
AnswerRe: Code style [modified] Pin
Pete O'Hanlon28-Jun-11 0:00
mvePete O'Hanlon28-Jun-11 0:00 
GeneralRe: Code style Pin
BobJanova28-Jun-11 0:06
BobJanova28-Jun-11 0:06 
GeneralRe: Code style Pin
Pete O'Hanlon28-Jun-11 0:30
mvePete O'Hanlon28-Jun-11 0:30 
GeneralRe: Code style Pin
Lutosław28-Jun-11 0:54
Lutosław28-Jun-11 0:54 
GeneralRe: Code style Pin
Pete O'Hanlon28-Jun-11 1:07
mvePete O'Hanlon28-Jun-11 1:07 
GeneralRe: Code style Pin
Lutosław28-Jun-11 1:17
Lutosław28-Jun-11 1:17 
GeneralRe: Code style Pin
BobJanova28-Jun-11 2:41
BobJanova28-Jun-11 2:41 
AnswerRe: Code style Pin
BobJanova28-Jun-11 0:05
BobJanova28-Jun-11 0:05 
I prefer the second, but I'd take the ellipse drawing out of the switch, since the logic is (to me) 'set up parameters depending on head type, then draw it' and the last part is common. So I'd do:

protected virtual void RenderHead(DrawingContext drawingContext, NoteHeadTypes type)
{
    double y = NoteVerticalPosition;
    double xRadiusFactor, yRadiusFactor;
    Brush brush;
    Pen pen;

    switch (type)
    {
        case NoteHeadTypes.Filled:
            yRadiusFactor = 1.1;
            xRadiusFactor = 1.2;
            brush = Brushes.Black;
            pen = NoteHeadPen;
            break;
        case NoteHeadTypes.Empty:
            yRadiusFactor = xRadiusFactor = 1;
            brush = Brushes.Transparent;
            pen = NoteBeamPen;
            break;
        default:
            // I think you need this to stop it complaining about 
            // unassigned variables below
            throw new ArgumentException("Unknown head type");
    }

    double xRadius = HeadXRadius * xRadiusFactor,
           yRadius = HeadYRadius * yRadiusFactor;
    drawingContext.DrawEllipse(brush, pen, xRadius / 2 + XOffset + 4.5, y, xRadius - 1, yRadius);
}

GeneralRe: Code style Pin
Lutosław28-Jun-11 1:03
Lutosław28-Jun-11 1:03 
AnswerRe: Code style PinPopular
Keith Barrow28-Jun-11 0:23
professionalKeith Barrow28-Jun-11 0:23 

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.