I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other
color).
I can get the line by using a GraphicsPath object but cannot work out the
shading part.
Is this also possible for say a circle with an outside line width of 10px to
be shaded from red to gray from the inside out around the circumference of
the circle.
TIA
JB 9 3254
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au... I wish to draw a line say 10px wide at a 45 degree angle (or any other angle) and have it shaded say from gray to red to gray again (or any other color).
I can get the line by using a GraphicsPath object but cannot work out the shading part.
Is this also possible for say a circle with an outside line width of 10px
to be shaded from red to gray from the inside out around the circumference of the circle.
TIA JB
how about something like :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100),
Color.Gray, Color.Red);
Pen p = new Pen(b,2);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200),
Color.Red, Color.Gray);
Pen p1 = new Pen(b1,2);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
}
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au... I wish to draw a line say 10px wide at a 45 degree angle (or any other angle) and have it shaded say from gray to red to gray again (or any other color).
I can get the line by using a GraphicsPath object but cannot work out the shading part.
Is this also possible for say a circle with an outside line width of 10px
to be shaded from red to gray from the inside out around the circumference of the circle.
TIA JB
Thanks for the reply Malek
I forgot to mention that it has to be shaded blue red blue along the axis of
the line.
i.e. if the line was flat then red along the top to blue in the middle and
back to red again at the bottom but again on a 45 angle.
Cheers
JB
"Malek" <ke****@arrabeta.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl... how about something like :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100), Color.Gray, Color.Red);
Pen p = new Pen(b,2);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200), Color.Red, Color.Gray);
Pen p1 = new Pen(b1,2);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
} "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:3z******************@news-server.bigpond.net.au... I wish to draw a line say 10px wide at a 45 degree angle (or any other angle) and have it shaded say from gray to red to gray again (or any
other color).
I can get the line by using a GraphicsPath object but cannot work out
the shading part.
Is this also possible for say a circle with an outside line width of
10px to be shaded from red to gray from the inside out around the circumference
of the circle.
TIA JB
something went wrong on my earlier answer, so here it is :
I guess something like this would do what you are looking for (this is for
lines, but you can do the same with aother shapes.)
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100),
Color.Black, Color.Red);
Pen p = new Pen(b,10);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new
Point(200,200), Color.Red, Color.Black);
Pen p1 = new Pen(b1,10);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
}
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:3z******************@news-server.bigpond.net.au... I wish to draw a line say 10px wide at a 45 degree angle (or any other angle) and have it shaded say from gray to red to gray again (or any other color).
I can get the line by using a GraphicsPath object but cannot work out the shading part.
Is this also possible for say a circle with an outside line width of 10px
to be shaded from red to gray from the inside out around the circumference of the circle.
TIA JB
trick it ... use rectangle for the line ...
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:J3*****************@news-server.bigpond.net.au... Thanks for the reply Malek
I forgot to mention that it has to be shaded blue red blue along the axis
of the line. i.e. if the line was flat then red along the top to blue in the middle and back to red again at the bottom but again on a 45 angle.
Cheers JB
"Malek" <ke****@arrabeta.com> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl... how about something like :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100), Color.Gray, Color.Red);
Pen p = new Pen(b,2);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new
Point(200,200), Color.Red, Color.Gray);
Pen p1 = new Pen(b1,2);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
} "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:3z******************@news-server.bigpond.net.au... I wish to draw a line say 10px wide at a 45 degree angle (or any other angle) and have it shaded say from gray to red to gray again (or any other color).
I can get the line by using a GraphicsPath object but cannot work out the shading part.
Is this also possible for say a circle with an outside line width of 10px to be shaded from red to gray from the inside out around the
circumference of the circle.
TIA JB
I was going to but cannot see a way of rotating the rectangle.
JB
"Malek" <ke****@arrabeta.com> wrote in message
news:eL****************@TK2MSFTNGP11.phx.gbl... trick it ... use rectangle for the line ...
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:J3*****************@news-server.bigpond.net.au... Thanks for the reply Malek
I forgot to mention that it has to be shaded blue red blue along the
axis of the line. i.e. if the line was flat then red along the top to blue in the middle
and back to red again at the bottom but again on a 45 angle.
Cheers JB
"Malek" <ke****@arrabeta.com> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl... how about something like :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100), Color.Gray, Color.Red);
Pen p = new Pen(b,2);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200), Color.Red, Color.Gray);
Pen p1 = new Pen(b1,2);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
} "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:3z******************@news-server.bigpond.net.au... > I wish to draw a line say 10px wide at a 45 degree angle (or any
other > angle) and have it shaded say from gray to red to gray again (or any other > color). > > I can get the line by using a GraphicsPath object but cannot work
out the > shading part. > > Is this also possible for say a circle with an outside line width of 10px to > be shaded from red to gray from the inside out around the circumference of > the circle. > > TIA > JB > >
here is going from border to middle to border of the line ... (perpendicular
to the line)
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(50,40),new Point(50,50),
Color.Gray, Color.Red);
Pen p = new Pen(b,10);
e.Graphics.DrawLine(p,new Point(0,45),new Point(100,45));
Brush b1 = new LinearGradientBrush(new Point(50,50),new Point(50,60),
Color.Red, Color.Gray);
Pen p1 = new Pen(b1,10);
e.Graphics.DrawLine(p1,new Point(0,55),new Point(100,55));
}
"Malek" <ke****@arrabeta.com> wrote in message
news:eL****************@TK2MSFTNGP11.phx.gbl... trick it ... use rectangle for the line ...
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:J3*****************@news-server.bigpond.net.au... Thanks for the reply Malek
I forgot to mention that it has to be shaded blue red blue along the
axis of the line. i.e. if the line was flat then red along the top to blue in the middle
and back to red again at the bottom but again on a 45 angle.
Cheers JB
"Malek" <ke****@arrabeta.com> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl... how about something like :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100), Color.Gray, Color.Red);
Pen p = new Pen(b,2);
e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100));
Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200), Color.Red, Color.Gray);
Pen p1 = new Pen(b1,2);
e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200));
} "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:3z******************@news-server.bigpond.net.au... > I wish to draw a line say 10px wide at a 45 degree angle (or any
other > angle) and have it shaded say from gray to red to gray again (or any other > color). > > I can get the line by using a GraphicsPath object but cannot work
out the > shading part. > > Is this also possible for say a circle with an outside line width of 10px to > be shaded from red to gray from the inside out around the circumference of > the circle. > > TIA > JB > >
use the method :
LinearGradientBrush (Rectangle rect, Color color1, Color color2, float
angle, bool isAngleScaleable)
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message
news:_m*****************@news-server.bigpond.net.au... I was going to but cannot see a way of rotating the rectangle. JB "Malek" <ke****@arrabeta.com> wrote in message news:eL****************@TK2MSFTNGP11.phx.gbl... trick it ... use rectangle for the line ...
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:J3*****************@news-server.bigpond.net.au... Thanks for the reply Malek
I forgot to mention that it has to be shaded blue red blue along the axis of the line. i.e. if the line was flat then red along the top to blue in the middle and back to red again at the bottom but again on a 45 angle.
Cheers JB
"Malek" <ke****@arrabeta.com> wrote in message news:%2******************@TK2MSFTNGP11.phx.gbl... > how about something like : > > protected override void OnPaint(PaintEventArgs e) > > { > > base.OnPaint (e); > > Brush b = new LinearGradientBrush(new Point(10,10),new
Point(100,100), > Color.Gray, Color.Red); > > Pen p = new Pen(b,2); > > e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100)); > > Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200), > Color.Red, Color.Gray); > > Pen p1 = new Pen(b1,2); > > e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200)); > > } > > > > "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message > news:3z******************@news-server.bigpond.net.au... > > I wish to draw a line say 10px wide at a 45 degree angle (or any other > > angle) and have it shaded say from gray to red to gray again (or
any other > > color). > > > > I can get the line by using a GraphicsPath object but cannot work out the > > shading part. > > > > Is this also possible for say a circle with an outside line width
of 10px > to > > be shaded from red to gray from the inside out around the circumference of > > the circle. > > > > TIA > > JB > > > > > >
Thanks Malek
"Malek" <ke****@arrabeta.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... use the method : LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle, bool isAngleScaleable)
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:_m*****************@news-server.bigpond.net.au... I was going to but cannot see a way of rotating the rectangle. JB "Malek" <ke****@arrabeta.com> wrote in message news:eL****************@TK2MSFTNGP11.phx.gbl... trick it ... use rectangle for the line ...
"John Baro" <jo***@NOSPAMmesware.com.au> wrote in message news:J3*****************@news-server.bigpond.net.au... > Thanks for the reply Malek > > I forgot to mention that it has to be shaded blue red blue along the axis of > the line. > i.e. if the line was flat then red along the top to blue in the
middle and > back to red again at the bottom but again on a 45 angle. > > Cheers > JB > > "Malek" <ke****@arrabeta.com> wrote in message > news:%2******************@TK2MSFTNGP11.phx.gbl... > > how about something like : > > > > protected override void OnPaint(PaintEventArgs e) > > > > { > > > > base.OnPaint (e); > > > > Brush b = new LinearGradientBrush(new Point(10,10),new Point(100,100), > > Color.Gray, Color.Red); > > > > Pen p = new Pen(b,2); > > > > e.Graphics.DrawLine(p,new Point(10,10),new Point(100,100)); > > > > Brush b1 = new LinearGradientBrush(new Point(100,100),new Point(200,200), > > Color.Red, Color.Gray); > > > > Pen p1 = new Pen(b1,2); > > > > e.Graphics.DrawLine(p1,new Point(100,100),new Point(200,200)); > > > > } > > > > > > > > "John Baro" <jo***@NOSPAMmesware.com.au> wrote in message > > news:3z******************@news-server.bigpond.net.au... > > > I wish to draw a line say 10px wide at a 45 degree angle (or any other > > > angle) and have it shaded say from gray to red to gray again (or any > other > > > color). > > > > > > I can get the line by using a GraphicsPath object but cannot
work out > the > > > shading part. > > > > > > Is this also possible for say a circle with an outside line
width of > 10px > > to > > > be shaded from red to gray from the inside out around the circumference > of > > > the circle. > > > > > > TIA > > > JB > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: john |
last post by:
Hi I am a C++ newbie, I am looking to draw single lines and simple
boxes in a C++ console window. Is there a draw command with x and y
coordinates that can be used with my Dev C++ compiler. For...
|
by: Mike Edwards |
last post by:
I need to use javascript's graphics API to draw the letters of
the alphabet. If necessary, I can map out all 26 letters myself
and use drawline() to draw them, but I am hoping someone out
there...
|
by: Andreas Schubert |
last post by:
Hello newsgroup,
I am pretty new to .NET and need some advise on
how to approach to the following:
I have to create an application with a drawing surface, where some
predefined shapes...
|
by: Dursun |
last post by:
Collegues, is it possible to do the foloowing:
Let end user draw specific shapes (a circle that has a number within it and
a connector that points to a specific area on the background image)...
|
by: davetelling |
last post by:
I am not a programmer, I'm an engineer trying to make an interface to a
product I'm designing. I have used C# to make a form that interrogates the
unit via the serial port and receives the data. I...
|
by: Tina |
last post by:
I need to find drawing software for my websites. I'm guessing that Adobe
Photoshop is an overkill. What's best for creating bitmaps usable for
websites?
Thanks,
T
|
by: James Stroud |
last post by:
Hello All,
I'm looking for a program to do line-drawings in 3d, with output to
postscript or svg or pdf, etc. I would like to describe a scene with
certain 1-3d elements oriented in 3d space...
|
by: Christie |
last post by:
I am writing my app using Visual Studio 2005 (VB.NET). I want to draw
images (nothing complex, just lines and shapes) using a mouse. How do
one go about achieving this with VB.NET??
If someone...
|
by: mattc66 via AccessMonster.com |
last post by:
Does anyone know of some simple line drawing add-on apps. I just need to be
able to do some simple line drawing with dims. 4 walls and a door and allow
the user to type the dims for the walls. All...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |