Click here to Skip to main content
15,900,378 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using C++ Code in C# Project/Solution? Pin
BobJanova13-Jul-11 0:11
BobJanova13-Jul-11 0:11 
GeneralRe: Using C++ Code in C# Project/Solution? Pin
Shameel13-Jul-11 2:21
professionalShameel13-Jul-11 2:21 
GeneralRe: Using C++ Code in C# Project/Solution? Pin
Manfred Rudolf Bihy13-Jul-11 0:40
professionalManfred Rudolf Bihy13-Jul-11 0:40 
GeneralRe: Using C++ Code in C# Project/Solution? Pin
Shameel13-Jul-11 2:21
professionalShameel13-Jul-11 2:21 
AnswerRe: Using C++ Code in C# Project/Solution? Pin
jschell13-Jul-11 9:16
jschell13-Jul-11 9:16 
GeneralRe: Using C++ Code in C# Project/Solution? Pin
AmbiguousName14-Jul-11 23:57
AmbiguousName14-Jul-11 23:57 
AnswerRe: Using C++ Code in C# Project/Solution? Pin
Morton song19-Jul-11 17:37
Morton song19-Jul-11 17:37 
QuestionDrawing a grid for plotting a graph Pin
Praveen Raghuvanshi12-Jul-11 19:23
professionalPraveen Raghuvanshi12-Jul-11 19:23 
Hi,

I am plotting a graph between frequency on x-axis and gain on y-axis.
X-axis(frequency) needs to vary logarithmically and y-axis(gain) needs to vary linearly.

The first step was to create the axis and put numbers on the lines.
As the default origin is at the Left Top corner of the client area, I moved the origin to the center of the client area and inverted the y-axis, so that whatever drawing takes place it should be as per the new origin and looks more realistic.

I tried to create few lines along with string to number them. Lines are drawn properly, however the string also got inverted.

Here is the code, I tried to use. It can be used in any winform application.

private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.TranslateTransform(this.ClientSize.Width / 2, this.ClientSize.Height / 2);
            g.ScaleTransform(1, -1);


            Point A = new Point(0, 0);
            Point B = new Point(120, 80);
            Point C = new Point(120, -80);

            g.DrawLine(Pens.Red, A, B);
            g.DrawLine(Pens.Green, A, C);

            g.DrawLine(Pens.Purple, 0, 0, -50, 70);
            //g.ResetTransform();
            g.DrawString("3", new Font("Arial", 16), new SolidBrush(Color.Purple), B); 
        }


Question 1: How can we draw string after inverting the y-axis?
Question 2: How can we make vertical lines that should vary logarithmically?

Any idea/solution is welcome.
Praveen Raghuvanshi
Software Developer

AnswerRe: Drawing a grid for plotting a graph Pin
lukeer12-Jul-11 21:03
lukeer12-Jul-11 21:03 
QuestionRe: Drawing a grid for plotting a graph Pin
Praveen Raghuvanshi12-Jul-11 22:41
professionalPraveen Raghuvanshi12-Jul-11 22:41 
AnswerRe: Drawing a grid for plotting a graph [modified] Pin
lukeer13-Jul-11 0:38
lukeer13-Jul-11 0:38 
GeneralRe: Drawing a grid for plotting a graph Pin
Praveen Raghuvanshi13-Jul-11 22:31
professionalPraveen Raghuvanshi13-Jul-11 22:31 
AnswerRe: Drawing a grid for plotting a graph Pin
BobJanova12-Jul-11 22:52
BobJanova12-Jul-11 22:52 
QuestionXMLTextReader - Find Max Depth Pin
Kevin Marois12-Jul-11 7:30
professionalKevin Marois12-Jul-11 7:30 
AnswerRe: XMLTextReader - Find Max Depth Pin
Heath Stewart12-Jul-11 12:27
protectorHeath Stewart12-Jul-11 12:27 
AnswerRe: XMLTextReader - Find Max Depth Pin
BobJanova13-Jul-11 0:48
BobJanova13-Jul-11 0:48 
QuestionVertical Alignment in RichTextbox Pin
Blubbo12-Jul-11 7:28
Blubbo12-Jul-11 7:28 
AnswerRe: Vertical Alignment in RichTextbox [modified] Pin
Carmelo La Monica12-Jul-11 7:55
professionalCarmelo La Monica12-Jul-11 7:55 
GeneralRe: Vertical Alignment in RichTextbox Pin
Blubbo12-Jul-11 8:00
Blubbo12-Jul-11 8:00 
GeneralRe: Vertical Alignment in RichTextbox Pin
Carmelo La Monica12-Jul-11 8:14
professionalCarmelo La Monica12-Jul-11 8:14 
GeneralRe: Vertical Alignment in RichTextbox Pin
Blubbo12-Jul-11 8:16
Blubbo12-Jul-11 8:16 
QuestionSQL DataGridView Pin
Falterfire12-Jul-11 6:02
Falterfire12-Jul-11 6:02 
AnswerRe: SQL DataGridView Pin
Dan Mos12-Jul-11 8:35
Dan Mos12-Jul-11 8:35 
GeneralRe: SQL DataGridView Pin
Falterfire12-Jul-11 8:58
Falterfire12-Jul-11 8:58 
AnswerRe: SQL DataGridView Pin
PIEBALDconsult12-Jul-11 17:42
mvePIEBALDconsult12-Jul-11 17:42 

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.