Click here to Skip to main content
15,905,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: Thread Label Updating Pin
OriginalGriff28-Oct-21 20:17
mveOriginalGriff28-Oct-21 20:17 
AnswerRe: Thread Label Updating Pin
BillWoodruff26-Oct-21 16:55
professionalBillWoodruff26-Oct-21 16:55 
Question.NET with problems Pin
Ismael Oliveira 202123-Oct-21 9:48
Ismael Oliveira 202123-Oct-21 9:48 
AnswerRe: .NET with problems Pin
Dave Kreskowiak23-Oct-21 12:15
mveDave Kreskowiak23-Oct-21 12:15 
AnswerRe: .NET with problems Pin
Gerry Schmitz23-Oct-21 16:00
mveGerry Schmitz23-Oct-21 16:00 
AnswerRe: .NET with problems Pin
BillWoodruff23-Oct-21 21:04
professionalBillWoodruff23-Oct-21 21:04 
AnswerRe: .NET with problems Pin
Matthew Dennis26-Oct-21 8:52
sysadminMatthew Dennis26-Oct-21 8:52 
QuestionC# Virtual Camera Pin
Software and Sowftware21-Oct-21 23:32
Software and Sowftware21-Oct-21 23:32 
AnswerRe: C# Virtual Camera Pin
lmoelleb22-Oct-21 2:30
lmoelleb22-Oct-21 2:30 
AnswerRe: C# Virtual Camera Pin
Gerry Schmitz22-Oct-21 7:37
mveGerry Schmitz22-Oct-21 7:37 
QuestionC# & .Net core new features related articles Pin
Mou_kol19-Oct-21 8:14
Mou_kol19-Oct-21 8:14 
AnswerRe: C# & .Net core new features related articles Pin
Richard Andrew x6419-Oct-21 10:48
professionalRichard Andrew x6419-Oct-21 10:48 
AnswerRe: C# & .Net core new features related articles Pin
BillWoodruff20-Oct-21 23:18
professionalBillWoodruff20-Oct-21 23:18 
QuestionSend Whatsapp Messages from C# Windows Forms Application Pin
Zeyad Jalil18-Oct-21 1:13
professionalZeyad Jalil18-Oct-21 1:13 
AnswerRe: Send Whatsapp Messages from C# Windows Forms Application Pin
OriginalGriff18-Oct-21 2:22
mveOriginalGriff18-Oct-21 2:22 
GeneralRe: Send Whatsapp Messages from C# Windows Forms Application Pin
Zeyad Jalil18-Oct-21 2:50
professionalZeyad Jalil18-Oct-21 2:50 
GeneralRe: Send Whatsapp Messages from C# Windows Forms Application Pin
Dave Kreskowiak18-Oct-21 3:54
mveDave Kreskowiak18-Oct-21 3:54 
AnswerRe: Send Whatsapp Messages from C# Windows Forms Application Pin
Bejide Basirat1-Apr-23 16:50
Bejide Basirat1-Apr-23 16:50 
QuestionSql dependency Pin
Nader Rostamkhani17-Oct-21 2:13
Nader Rostamkhani17-Oct-21 2:13 
AnswerRe: Sql dependency Pin
OriginalGriff17-Oct-21 2:44
mveOriginalGriff17-Oct-21 2:44 
QuestionDesigning a shape object class in C# Pin
Stephen Holdorf17-Oct-21 0:48
Stephen Holdorf17-Oct-21 0:48 
AnswerRe: Designing a shape object class in C# Pin
BillWoodruff17-Oct-21 9:02
professionalBillWoodruff17-Oct-21 9:02 
Hi, i happen to be working on a shape library for WinForms C# right now; i'll eventually publish it here, but, can't predict when. Let me offer some general ideas:

1) choice of Framework is important: a lot depends on what you want to do with your shapes. my usage is for custom ring design; for example, i need to calculate equally spaced points along a path like an oval, and that point's tangent (requires calculus); i deal primarily with polygons, circles and ellipses; my goal is to have mock-ups i can take to my manufacturers. so, i'm not concerned with 3d rendering on screen, texturing, etc. and i'm not concerned with interacting with selecting/moving/duplicating shapes on-screen as you expect in a drawing program,

2) for other purposes, like the ones i just said i'm not concerned with, WPF offers a superior graphics engine and facilities; and, for 3d; use Unity. if you do need to select/move/duplicate/dock etc., shapes on-screen: don't use WinForms, use WPF.

3) the interface i am using now: the use of System.Windows requires your WinForm project to have a reference to WindowsBase.dll
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows;

using SdPoint = System.Drawing.Point;
using SwPoint = System.Windows.Point;
using SdSize = System.Drawing.Size;
using SwSize = System.Windows.Size;

using GraphicsPath = System.Drawing.Drawing2D.GraphicsPath;
using GReg = System.Drawing.Region;
using GMat2d = System.Drawing.Drawing2D.Matrix;
using GMatMed = System.Windows.Media.Matrix;

namespace GeomLib_August_2021_III
{
    public enum ShapeType
    {
        Line,
        Arc,
        Rectangle,
        Parallelogram,
        Circle,
        Ellipse,
        RegPolygon,
        IrregPolygon,
        Grid,
        Star
    }

    public interface IShape
    {
        string ShpName { get; }
        string ShpComment { get; }
        DateTime ShpTimeStamp { get; }
        ShapeType ShpType { get; }

        Rect SwRect { get; }
        SwPoint CenterF { get; }
        SwPoint[] PathPoints { get; }

        double GetArea();
        double GetPerimeter();
        SwPoint GetCenter();
        GraphicsPath GetGPath();
        Region GetRegion();

        IShape GetUnion(IShape s1, IShape s2);
        IShape GetIntersection(IShape s1, IShape s2);

        IShape Translate(IShape s1, Matrix m1);
        IShape Rotate(IShape s1, Matrix m1);
        IShape Scale(IShape s1, Matrix m1);

        SwPoint[] Flatten();
        void Render();
        void Save();
        void Load()
    }
}
Each shape name listed in the ShapeType Enum is implemented as a class that inherits from IShape, and implements its fields, and methods.

4) typical OO shape modeling uses "nested" inheritance; you might have:

class Poly : IShape
class Triangle : Poly
class Rectangle : Poly
class Parallelogram : Rectangle

class RegularPolygon : Poly
class EqTriangle : RegularPolygon // or EqTriangle : Triangle
class Square ; RegularPolygon // or Square : Rectangle

class Circle : IShape
class Ellipse : Circle

5) there any number of ways you can organize the top level hierarchy to meet your goals.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch


modified 18-Oct-21 3:18am.

GeneralRe: Designing a shape object class in C# Pin
Pete O'Hanlon17-Oct-21 21:47
mvePete O'Hanlon17-Oct-21 21:47 
GeneralRe: Designing a shape object class in C# Pin
BillWoodruff18-Oct-21 0:59
professionalBillWoodruff18-Oct-21 0:59 
AnswerRe: Designing a shape object class in C# Pin
Gerry Schmitz17-Oct-21 11:47
mveGerry Schmitz17-Oct-21 11:47 

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.