Click here to Skip to main content
15,892,737 members
Home / Discussions / C#
   

C#

 
QuestionReading registry keys Pin
rakeshs31229-Dec-10 18:23
rakeshs31229-Dec-10 18:23 
AnswerRe: Reading registry keys Pin
Abhinav S29-Dec-10 18:31
Abhinav S29-Dec-10 18:31 
AnswerRe: Reading registry keys Pin
RaviRanjanKr29-Dec-10 18:50
professionalRaviRanjanKr29-Dec-10 18:50 
AnswerRe: Reading registry keys Pin
Anil Kumar.Arvapalli29-Dec-10 20:44
Anil Kumar.Arvapalli29-Dec-10 20:44 
GeneralRe: Reading registry keys Pin
PIEBALDconsult30-Dec-10 2:24
mvePIEBALDconsult30-Dec-10 2:24 
AnswerRe: Reading registry keys Pin
Kevin Marois30-Dec-10 5:40
professionalKevin Marois30-Dec-10 5:40 
QuestionListView scroll while typing Pin
Figmo229-Dec-10 16:52
Figmo229-Dec-10 16:52 
QuestionHot to draw ellipse line intersection Pin
ferry24029-Dec-10 9:35
ferry24029-Dec-10 9:35 
Hi, guys Smile | :) .
I write a simple application for drawing a vector primitives such a ellipse, line, rectangle, polygon, etc. I want to add a class for a new shape - ellipse with two lines in it, but I'm stuck on this Frown | :( . Can you give me some help?

This is the code of my Ellipse class:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;


namespace _2D_Vector_Graphics
{
    [Serializable]
    class EllipseShape : Shape
    {
        public RectangleF SetLocation
        {
            set
            {
                this.Location = value.Location;
                this.ModelSize = value.Size;
            }
        }

        public EllipseShape()
        {
            this.ModelSize = new SizeF(0, 0); 
            this.Location = new PointF(-10, -10);
            this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
        }

        public EllipseShape(Color newFillColor, Color newBorderColor, int newBorderWidth, SizeF newModelSize, PointF newlocation)
        {
            this.FillColor = newFillColor; 
            this.BorderColor = newBorderColor; 
            this.BorderWidth = newBorderWidth; 
            this.ModelSize = newModelSize; 
            this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
        }
        public override void DrawYourSelf(Graphics graphics)
        {
           
            GraphicsPath path=new GraphicsPath();
            path.AddEllipse(new RectangleF(Location, ModelSize));
            path.Transform(this.TMatrix.TransformationMatrix);
         
            Pen pen = new Pen(this.BorderColor, this.BorderWidth);
            
            if (IS_FILLED)
            {
                SolidBrush brush = new SolidBrush(this.FillColor);
                graphics.FillPath(brush, path);
            }
            graphics.DrawPath(pen,path);
            if (this.Selected)
            {
                this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
                this.selectionUnit.DrawYourSelf(graphics);
            }
        }
        
        public override RectangleF ReturnBounds()
        {
            GraphicsPath path = new GraphicsPath();
            path.AddEllipse(new RectangleF(Location, ModelSize));
            path.Transform(this.TMatrix.TransformationMatrix);
            return  path.GetBounds();
        }
    }
}


And this is the code of my Line class:

using System;
using System.Collections.Generic;
using System.Collections;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace _2D_Vector_Graphics
{
    [Serializable]
    class LineShape : Shape
    {
        protected Point begin,end;
        public Point SetBegin
        {
            set
            {
               begin= value  ;
            }
        }
        public Point SetEnd
        {
            set
            {
                end = value;
            }
        }
        public LineShape()
        {
            this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
        }
        public LineShape(Point begin, Point end)
        {
           
            this.begin = begin;
            this.end = end;
            this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
        }
        public LineShape(Point begin, Point end, Color newBorderColor, int newBorderWidth)
        {
            this.begin = begin;
            this.end = end;
            this.BorderColor = newBorderColor;
            this.BorderWidth = newBorderWidth;
            this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
        }

        public override void DrawYourSelf(Graphics graphics)
        {
            GraphicsPath path = new GraphicsPath();
            path.AddLine(begin,end);
            path.Transform(this.TMatrix.TransformationMatrix);
            Pen pen = new Pen(this.BorderColor, this.BorderWidth);
            graphics.DrawPath(pen, path);
            if (this.Selected)
            {
                this.selectionUnit = new CoveringRectangle(Rectangle.Round(ReturnBounds()));
                this.selectionUnit.DrawYourSelf(graphics);
            }
        }

        public override RectangleF ReturnBounds()
        {
            GraphicsPath path = new GraphicsPath();
            path.AddLine(begin, end);
            path.Transform(this.TMatrix.TransformationMatrix);
            return  path.GetBounds();
        }
    }
}

AnswerRe: Hot to draw ellipse line intersection Pin
fjdiewornncalwe29-Dec-10 9:48
professionalfjdiewornncalwe29-Dec-10 9:48 
GeneralRe: Hot to draw ellipse line intersection Pin
ferry24029-Dec-10 10:33
ferry24029-Dec-10 10:33 
GeneralRe: Hot to draw ellipse line intersection Pin
fjdiewornncalwe29-Dec-10 10:49
professionalfjdiewornncalwe29-Dec-10 10:49 
QuestionWindows Phone 7 passing multiple items between pages Pin
Paul Harsent29-Dec-10 8:06
Paul Harsent29-Dec-10 8:06 
AnswerRe: Windows Phone 7 passing multiple items between pages Pin
Pete O'Hanlon29-Dec-10 9:09
mvePete O'Hanlon29-Dec-10 9:09 
GeneralRe: Windows Phone 7 passing multiple items between pages Pin
Paul Harsent29-Dec-10 10:47
Paul Harsent29-Dec-10 10:47 
GeneralRe: Windows Phone 7 passing multiple items between pages Pin
Pete O'Hanlon29-Dec-10 10:49
mvePete O'Hanlon29-Dec-10 10:49 
QuestionProblem with reading Bytes Pin
Honeyboy_2029-Dec-10 7:49
Honeyboy_2029-Dec-10 7:49 
AnswerRe: Problem with reading Bytes Pin
Honeyboy_2029-Dec-10 7:50
Honeyboy_2029-Dec-10 7:50 
GeneralRe: Problem with reading Bytes Pin
Richard MacCutchan29-Dec-10 9:23
mveRichard MacCutchan29-Dec-10 9:23 
GeneralRe: Problem with reading Bytes Pin
Luc Pattyn29-Dec-10 9:34
sitebuilderLuc Pattyn29-Dec-10 9:34 
AnswerRe: Problem with reading Bytes Pin
carbon_golem29-Dec-10 8:34
carbon_golem29-Dec-10 8:34 
GeneralRe: Problem with reading Bytes Pin
Honeyboy_2029-Dec-10 8:57
Honeyboy_2029-Dec-10 8:57 
GeneralRe: Problem with reading Bytes Pin
Henry Minute29-Dec-10 9:29
Henry Minute29-Dec-10 9:29 
GeneralRe: Problem with reading Bytes Pin
carbon_golem29-Dec-10 10:30
carbon_golem29-Dec-10 10:30 
AnswerRe: Problem with reading Bytes Pin
carbon_golem29-Dec-10 12:47
carbon_golem29-Dec-10 12:47 
GeneralRe: Problem with reading Bytes Pin
Roger Wright2-Jan-11 18:09
professionalRoger Wright2-Jan-11 18:09 

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.