Click here to Skip to main content
15,894,405 members
Home / Discussions / C#
   

C#

 
GeneralRe: Webservice returns dataset as an xml Pin
manognya kota3-Jan-12 0:33
manognya kota3-Jan-12 0:33 
AnswerRe: Webservice returns dataset as an xml Pin
BobJanova3-Jan-12 2:28
BobJanova3-Jan-12 2:28 
QuestiontabControl Pin
Me kiter1-Jan-12 7:58
Me kiter1-Jan-12 7:58 
AnswerRe: tabControl Pin
David C# Hobbyist.1-Jan-12 8:19
professionalDavid C# Hobbyist.1-Jan-12 8:19 
AnswerRe: tabControl Pin
Luc Pattyn1-Jan-12 9:05
sitebuilderLuc Pattyn1-Jan-12 9:05 
AnswerRe: tabControl Pin
Engineer khalili1-Jan-12 9:27
professionalEngineer khalili1-Jan-12 9:27 
AnswerRe: tabControl Pin
PIEBALDconsult1-Jan-12 12:08
mvePIEBALDconsult1-Jan-12 12:08 
QuestionHow to detect intersecting lines in C#? Pin
Member 83806481-Jan-12 5:05
Member 83806481-Jan-12 5:05 
I'm creating a program in C# that do not allow intersecting lines. How will I modify my code? Thank you.
I've already uploaded the whole source code of my program HERE (http://www.mediafire.com/?2g52fiqanma3hkx[^]) for you to check the other class I've included.But here's the code for the drawing process:

<pre lang="c#">

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form3 : Form
    {
        private Boolean _calculateDouglasPeuckerReduction = false;
        private List<WindowsFormsApplication2.PointEnhanced> _amerenPoints = new List<WindowsFormsApplication2.PointEnhanced>();


        public Form3()
        {
            InitializeComponent();
        }


        protected override void OnPaint(PaintEventArgs e)
        {

            List<System.Drawing.Point> drawingPoints = new List<System.Drawing.Point>();
            foreach (WindowsFormsApplication2.PointEnhanced point in _amerenPoints)
            {
                drawingPoints.Add(new System.Drawing.Point(Convert.ToInt32(point.X), Convert.ToInt32(point.Y)));

            }

            if (drawingPoints.Count > 2)
            {
                e.Graphics.DrawLines(new Pen(Brushes.Black, 2), drawingPoints.ToArray());
                lblOriginal2.Text = drawingPoints.Count.ToString();

                if (_calculateDouglasPeuckerReduction)
                {
                    List<WindowsFormsApplication2.PointEnhanced> points = Utility2.DouglasPeuckerReduction(_amerenPoints, Convert.ToDouble(nudTolerance2.Value));
                    drawingPoints = new List<System.Drawing.Point>();
                    foreach (WindowsFormsApplication2.PointEnhanced point in points)
                    {
                        drawingPoints.Add(new System.Drawing.Point(Convert.ToInt32(point.X), Convert.ToInt32(point.Y)));
                    }

                    e.Graphics.DrawLines(new Pen(Brushes.Red, 2), drawingPoints.ToArray());
                    lblSimplified2.Text = drawingPoints.Count.ToString();
                }
            }


            base.OnPaint(e);
        }
        private void Form3_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                _amerenPoints.Add(new WindowsFormsApplication2.PointEnhanced(e.X, e.Y));
                this.Invalidate();
            }
        }

        private void Form3_MouseUp(object sender, MouseEventArgs e)
        {
            //DO the calculation
            _calculateDouglasPeuckerReduction = true;
            this.Invalidate();
        }

        private void Form3_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                _amerenPoints.Clear();
                _calculateDouglasPeuckerReduction = false;
            }
        }

        private void nudTolerance2_ValueChanged(object sender, EventArgs e)
        {
            this.Invalidate();
        }

        private void Form3_Load(object sender, EventArgs e)
        {

        }

    }
}

AnswerRe: How to detect intersecting lines in C#? Pin
Richard MacCutchan1-Jan-12 23:27
mveRichard MacCutchan1-Jan-12 23:27 
AnswerRe: How to detect intersecting lines in C#? Pin
V.2-Jan-12 1:35
professionalV.2-Jan-12 1:35 
AnswerRe: How to detect intersecting lines in C#? Pin
Luc Pattyn2-Jan-12 3:01
sitebuilderLuc Pattyn2-Jan-12 3:01 
QuestionConvert C# windows app to android Pin
jojoba201131-Dec-11 5:13
jojoba201131-Dec-11 5:13 
AnswerRe: Convert C# windows app to android PinPopular
Richard Andrew x6431-Dec-11 5:29
professionalRichard Andrew x6431-Dec-11 5:29 
GeneralRe: Convert C# windows app to android Pin
jojoba201131-Dec-11 5:44
jojoba201131-Dec-11 5:44 
GeneralRe: Convert C# windows app to android Pin
Pete O'Hanlon31-Dec-11 7:10
mvePete O'Hanlon31-Dec-11 7:10 
GeneralRe: Convert C# windows app to android Pin
Rajesh Anuhya1-Jan-12 1:06
professionalRajesh Anuhya1-Jan-12 1:06 
AnswerRe: Convert C# windows app to android Pin
Dave Kreskowiak31-Dec-11 11:49
mveDave Kreskowiak31-Dec-11 11:49 
AnswerRe: Convert C# windows app to android Pin
jschell31-Dec-11 13:34
jschell31-Dec-11 13:34 
AnswerRe: Convert C# windows app to android Pin
V.2-Jan-12 1:39
professionalV.2-Jan-12 1:39 
QuestionLooking for help with form focus Pin
turbosupramk330-Dec-11 18:06
turbosupramk330-Dec-11 18:06 
AnswerRe: Looking for help with form focus Pin
Richard MacCutchan30-Dec-11 22:38
mveRichard MacCutchan30-Dec-11 22:38 
GeneralRe: Looking for help with form focus Pin
turbosupramk331-Dec-11 3:08
turbosupramk331-Dec-11 3:08 
GeneralRe: Looking for help with form focus Pin
Richard MacCutchan31-Dec-11 3:44
mveRichard MacCutchan31-Dec-11 3:44 
GeneralRe: Looking for help with form focus Pin
turbosupramk331-Dec-11 4:19
turbosupramk331-Dec-11 4:19 
AnswerRe: Looking for help with form focus Pin
Alan N31-Dec-11 3:43
Alan N31-Dec-11 3:43 

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.