Click here to Skip to main content
15,907,326 members
Home / Discussions / C#
   

C#

 
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 
QuestionLooking for feedback and contributions to database project Pin
Michael Sydney Balloni16-Oct-21 17:27
professionalMichael Sydney Balloni16-Oct-21 17:27 
AnswerRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan16-Oct-21 21:14
mveRichard MacCutchan16-Oct-21 21:14 
GeneralRe: Looking for feedback and contributions to database project Pin
BillWoodruff16-Oct-21 23:36
professionalBillWoodruff16-Oct-21 23:36 
GeneralRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan17-Oct-21 1:25
mveRichard MacCutchan17-Oct-21 1:25 
GeneralRe: Looking for feedback and contributions to database project Pin
BillWoodruff17-Oct-21 4:24
professionalBillWoodruff17-Oct-21 4:24 
GeneralRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan17-Oct-21 21:52
mveRichard MacCutchan17-Oct-21 21:52 
GeneralRe: Looking for feedback and contributions to database project Pin
BillWoodruff18-Oct-21 3:56
professionalBillWoodruff18-Oct-21 3:56 
GeneralRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan18-Oct-21 4:35
mveRichard MacCutchan18-Oct-21 4:35 
GeneralRe: Looking for feedback and contributions to database project Pin
BillWoodruff18-Oct-21 5:38
professionalBillWoodruff18-Oct-21 5:38 
GeneralRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan18-Oct-21 5:48
mveRichard MacCutchan18-Oct-21 5:48 
GeneralRe: Looking for feedback and contributions to database project Pin
BillWoodruff18-Oct-21 11:40
professionalBillWoodruff18-Oct-21 11:40 
GeneralRe: Looking for feedback and contributions to database project Pin
Richard MacCutchan18-Oct-21 21:39
mveRichard MacCutchan18-Oct-21 21:39 
AnswerRe: Looking for feedback and contributions to database project Pin
BillWoodruff16-Oct-21 23:25
professionalBillWoodruff16-Oct-21 23:25 
GeneralRe: Looking for feedback and contributions to database project Pin
Michael Sydney Balloni24-Oct-21 14:14
professionalMichael Sydney Balloni24-Oct-21 14:14 

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.