Click here to Skip to main content
15,923,087 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get Time C#(read only memory) Pin
Bernhard Hiller30-Dec-10 19:54
Bernhard Hiller30-Dec-10 19:54 
AnswerRe: Get Time C#(read only memory) Pin
Rob Philpott30-Dec-10 1:35
Rob Philpott30-Dec-10 1:35 
GeneralRe: Get Time C#(read only memory) Pin
arun_pk30-Dec-10 2:04
arun_pk30-Dec-10 2:04 
GeneralRe: Get Time C#(read only memory) Pin
Rob Philpott30-Dec-10 2:08
Rob Philpott30-Dec-10 2:08 
AnswerRe: Get Time C#(read only memory) Pin
OriginalGriff30-Dec-10 2:16
mveOriginalGriff30-Dec-10 2:16 
Questionmaking two different style of datagridview's one cell Pin
Erdinc2729-Dec-10 21:11
Erdinc2729-Dec-10 21:11 
AnswerRe: making two different style of datagridview's one cell Pin
_Erik_30-Dec-10 0:17
_Erik_30-Dec-10 0:17 
AnswerRe: making two different style of datagridview's one cell Pin
Henry Minute30-Dec-10 3:16
Henry Minute30-Dec-10 3:16 
AnswerRe: making two different style of datagridview's one cell Pin
Dave Kreskowiak30-Dec-10 4:24
mveDave Kreskowiak30-Dec-10 4:24 
GeneralRe: making two different style of datagridview's one cell Pin
Erdinc2730-Dec-10 21:17
Erdinc2730-Dec-10 21:17 
QuestionC# IME (Input Method Editor) Pin
vnmatt29-Dec-10 19:57
vnmatt29-Dec-10 19:57 
AnswerRe: C# IME (Input Method Editor) Pin
Richard MacCutchan29-Dec-10 22:40
mveRichard MacCutchan29-Dec-10 22:40 
AnswerRe: C# IME (Input Method Editor) Pin
Michael Agroskin30-Dec-10 16:22
Michael Agroskin30-Dec-10 16:22 
GeneralRe: C# IME (Input Method Editor) Pin
vnmatt31-Dec-10 3:52
vnmatt31-Dec-10 3:52 
AnswerRe: C# IME (Input Method Editor) Pin
greg ofiesh13-Jan-11 7:47
greg ofiesh13-Jan-11 7:47 
QuestionDetection of Facial Feature points in OpenCV Pin
mkfrns29-Dec-10 19:45
mkfrns29-Dec-10 19:45 
AnswerRe: Detection of Facial Feature points in OpenCV Pin
JF201529-Dec-10 21:52
JF201529-Dec-10 21:52 
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();
        }
    }
}

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.