Click here to Skip to main content
15,889,413 members
Home / Discussions / Graphics
   

Graphics

 
Question3D mesh Surface with C++ GDI / GDI+ / simple canvas Pin
Austin_Cpp27-Mar-15 15:02
Austin_Cpp27-Mar-15 15:02 
AnswerRe: 3D mesh Surface with C++ GDI / GDI+ / simple canvas Pin
Richard MacCutchan27-Mar-15 22:12
mveRichard MacCutchan27-Mar-15 22:12 
GeneralRe: 3D mesh Surface with C++ GDI / GDI+ / simple canvas Pin
Austin_Cpp27-Mar-15 22:33
Austin_Cpp27-Mar-15 22:33 
Questionhow to compare if two image are roughly the same with threshold? Pin
neodeaths27-Feb-15 11:05
neodeaths27-Feb-15 11:05 
QuestionNumber of vertices in Blender vs number of vertices in XNA Pin
KamranKamal23-Feb-15 12:46
KamranKamal23-Feb-15 12:46 
AnswerRe: Number of vertices in Blender vs number of vertices in XNA Pin
KamranKamal23-Feb-15 23:53
KamranKamal23-Feb-15 23:53 
QuestionLooking for Cartesian graphic component for dotnet.... Pin
Sam Marrocco15-Jan-15 6:36
Sam Marrocco15-Jan-15 6:36 
Answeruse System.Drawing namespace; Pin
Nitin K. Kawale26-Jan-15 17:50
professionalNitin K. Kawale26-Jan-15 17:50 
please use System.Drawing namespace in your project.
where you find the Graphics class which will give you all option to Draw anything by using cartesian co-ordinate system.
for example..

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace WaveformDemo
{
public partial class WaveDisplay : UserControl
{
[DefaultValue(10)]
int _XDivision; //Total X Division
[DefaultValue(10)]
int _YDivision;

[DefaultValue(10.0f)]//1 Volt per Division
float _voltsPerDivision;
[DefaultValue(10.0f)]//1 Sec per Division
float _timePerDivision;

[Browsable(true),DefaultValue(10)]
public int XDivisions
{
get
{
return _XDivision;
}
set
{
_XDivision = value;
}
}
[Browsable(true), DefaultValue(10)]

public int YDivisions
{
get
{
return _YDivision;
}
set
{
_YDivision = value;
}
}
[Browsable(true),DefaultValue(10.0f)]
public float VoltagePerDivision
{
get
{
return _voltsPerDivision;
}
set
{
_voltsPerDivision = value;
}
}
[Browsable(true), DefaultValue(10.0f)]
public float TimePerDivision
{
get
{
return _timePerDivision;
}
set
{
_timePerDivision = value;
}
}
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
public override ImageLayout BackgroundImageLayout
{
get
{
return base.BackgroundImageLayout;
}
set
{
base.BackgroundImageLayout = value;
}
}
public WaveDisplay()
{
InitializeComponent();
_voltsPerDivision = 10.0f;
_timePerDivision = 10.0f;
_XDivision = 10;
_YDivision = 10;
_s = new Sample();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;

if (BackgroundImage != null)
{

g.DrawImage(BackgroundImage, ClientRectangle);


}
else
{
Brush b = null;
b = new SolidBrush(this.BackColor);
g.FillRectangle(b, this.ClientRectangle);
}


Pen pen = new Pen(ForeColor);
Rectangle r = new Rectangle(ClientRectangle.Left, ClientRectangle.Top, ClientRectangle.Width, ClientRectangle.Height);
r.Inflate(new Size((int)(-ClientRectangle.Width * 0.1f),(int) (-ClientRectangle.Height * 0.1f)));
double xPixelPerDiv = (double)r.Width / (double)_XDivision;
double yPixelPerDiv = (double)r.Height /(double)_YDivision;
double TimePerUnit = _timePerDivision/_XDivision;
double VoltsPerUnit = _voltsPerDivision/_YDivision;
string s1 = null;
for (int i = 0; i <= _XDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left + xPixelPerDiv * i), r.Top),
new Point((int)(r.Left + xPixelPerDiv * i), r.Bottom));
s1 = (_timePerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF((int)(r.Left + xPixelPerDiv * i), r.Bottom + 10));

}
for (int i = 0; i <= _YDivision; i++)
{
g.DrawLine(pen, new Point((int)(r.Left), (int)(r.Bottom - i * yPixelPerDiv)),
new Point((int)(r.Right), (int)(r.Bottom - i * yPixelPerDiv)));
s1 = (_voltsPerDivision * i).ToString();
g.DrawString(s1, Font, new SolidBrush(ForeColor), new PointF(r.Left - 15, (int)(r.Bottom - yPixelPerDiv * i)));
}
_s.Render(g,r,XDivisions*TimePerDivision);
//base.OnPaint(e);
}
Sample _s;
}
}
GeneralRe: use System.Drawing namespace; Pin
Sam Marrocco27-Jan-15 2:35
Sam Marrocco27-Jan-15 2:35 
QuestionRotate TTF Font Glyph? Pin
radarcontact29-Nov-14 14:25
radarcontact29-Nov-14 14:25 
QuestionDx installation Pin
Otekpo Emmanuel20-Nov-14 19:20
Otekpo Emmanuel20-Nov-14 19:20 
AnswerRe: Dx installation Pin
Richard MacCutchan20-Nov-14 21:52
mveRichard MacCutchan20-Nov-14 21:52 
GeneralRe: Dx installation Pin
Otekpo Emmanuel20-Nov-14 23:29
Otekpo Emmanuel20-Nov-14 23:29 
GeneralRe: Dx installation Pin
Richard MacCutchan20-Nov-14 23:47
mveRichard MacCutchan20-Nov-14 23:47 
GeneralRe: Dx installation Pin
Jochen Arndt21-Nov-14 0:24
professionalJochen Arndt21-Nov-14 0:24 
QuestionMeasuring of Text with Multiple Fonts in One Single Line Pin
paul116730-Oct-14 21:59
paul116730-Oct-14 21:59 
AnswerRe: Measuring of Text with Multiple Fonts in One Single Line Pin
paul116731-Oct-14 2:12
paul116731-Oct-14 2:12 
GeneralRe: Measuring of Text with Multiple Fonts in One Single Line Pin
PaulB482-Nov-14 2:22
PaulB482-Nov-14 2:22 
GeneralRe: Measuring of Text with Multiple Fonts in One Single Line Pin
paul116713-Nov-14 22:17
paul116713-Nov-14 22:17 
QuestionImage editor control for asp.net Pin
Member 111274939-Oct-14 19:22
Member 111274939-Oct-14 19:22 
AnswerRe: Image editor control for asp.net Pin
Garth J Lancaster9-Oct-14 19:33
professionalGarth J Lancaster9-Oct-14 19:33 
QuestionPNG vs JPG Pin
V.11-Sep-14 19:46
professionalV.11-Sep-14 19:46 
AnswerRe: PNG vs JPG Pin
Peter_in_278011-Sep-14 20:51
professionalPeter_in_278011-Sep-14 20:51 
AnswerRe: PNG vs JPG Pin
Pete O'Hanlon11-Sep-14 21:01
mvePete O'Hanlon11-Sep-14 21:01 
AnswerRe: PNG vs JPG Pin
Chris Losinger2-Dec-14 4:31
professionalChris Losinger2-Dec-14 4:31 

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.