Line Segment ActiveX Control

  • Thread starter Thread starter Jacky Luk
  • Start date Start date
J

Jacky Luk

Does anyone know of a downloadable Line ActiveX control which allows me to
plot straight lines on a VC++.NET form?
Thanks
Jack
 
Jacky Luk said:
Does anyone know of a downloadable Line ActiveX control which allows me to
plot straight lines on a VC++.NET form?

I'm not sure exactly what you have in mind, but you should be able to draw
simple straight lines on a form using Control::CreateGraphics() and
Graphics::DrawLine() as follows:

// Warning: code untested
using System.Drawing; // Remember dependency system.drawing.dll
using System.Windows.Forms; // Remember dependency system.windows.forms.dll

void DrawFormLine(Form form, Pen pen, Point start, Point end) {
Graphics g = form.CreateGraphics();
g.DrawLine(pen, start, end);
}

I hope this helps - please reply if I misunderstood you or this solution
causes any trouble.
 
Derrick said:
Jacky Luk said:
Does anyone know of a downloadable Line ActiveX control which allows me
to plot straight lines on a VC++.NET form?

I'm not sure exactly what you have in mind, but you should be able to draw
simple straight lines on a form using Control::CreateGraphics() and
Graphics::DrawLine() as follows: [ snip ]

Yes. Though, I need to draw the lines visually at design time

If it's only horizontal and vertical lines you're interested in, you might
check out this article:

http://msdn.microsoft.com/library/d...vxconchangestolinecontrolinvisualbasicnet.asp

Although it references VB.NET, the controls are the same in every .NET
language and the same trick should work:

"During upgrade, vertical or horizontal Line controls are replaced with the
Windows Forms Label control, with the Text property set to an empty string,
the BorderStyle property set to none, and the BackColor, Width, and Height
properties set to match the original control."

If you're looking instead to draw lines of arbitrary slope, unfortunately I
haven't found anything to do this, but if you're interested I could whip
something up.
 
Derrik:
Ironic Process (low cost) (and graphics server.com-high cost)) have nice
Graphics server engines that can be added to a form in vc++.net via this
added toolbox plugin, and nicely complements the existing toolbox in
vc++.NET. I can't get them hooked up to read file data and update in real
time as a file changes. It's easy to load the server to a form but I'm stuck
on these real simple looking Ironic.ChartControl namespace method calls
below. Can you help/recommend? Info below. Thanks, Mike


http://www.ironic-processes.com
Chart Plotter 2004 is provided as a single Dynamic Link Library (DLL) file.
This DLL file is a fully configured Control for .Net environments, and can be
rapidly deployed to .Net IDEs (Integrated Development Environments) and
configured using the Property Browser. (NB alternatively, all of the
Properties defined in the Property Overview page are ‘Public’ and can be
configured in code.)

To add the DLL to your project, either add a Reference to the Solution
(Right Click on ‘References’, select ‘Add Reference..’ and browse to the
location of the ChartControl.dll file). The Chart Plotter 2004 control can
then be accessed by referencing the Ironic.ChartControl namespace.

Alternatively, to add the Control to your Toolbox (recommended), simply
select Tools | Add/Remove Toolbox items.., and browse to the ChartControl.dll
file. This will automatically add Chart Plotter 2004 to your Toolbox so that
it can be ‘Drawn’ live onto Forms.

Then simply add a couple of method calls to your code to plot the values,
and reset the data when you are finished.

METHOD CALLS:


Chart Plotter 2004 Public Methods



Plotting data on the Chart Plotter 2004 is extremely simple, requiring the
minimum amount of coding. All appearance and behavioural properties are
available within the Property Browser window, enabling Chart Plotter 2004 to
be rapidly ‘Dropped’ into an application, and fully adhering to the standard
of visual design, development and Rapid Application development.



After having ‘Drawn’ Chart Plotter 2004 onto your application Form, and used
the Property Browser to set the appearance and behavioural properties, it is
necessary to add the code to actually ‘Plot’ a value onto the display.



The default Chart Plotter has one single Plot Line defined, however it is
necessary to add more Plot Lines if more than one data plot is desired. (See
PlotLineCollection in the Property Overview)



The required methods are:



Method Name
Description
Argument/s
Return Type

plotValue
Plots a value on the specified line


int LineNumber, float valueToPlot


-

plotMultipleValues
Plot an array of values – similar to plotValue except this method is
optimised to take an array of line numbers and an equal length array of
values and plot them all in one method. This method should be used to
optimise performance when more than one plot line is used.


int lines __gc [], float values __gc []


resetAll
Resets all data (removes any current plots)


-
-

TimeIncrement
Increment the time value on the X-Axis (Manually. This method is not
necessary if the IncrementTime property is set to ‘OnPlotLine1’ and plotValue
is called periodically for Plot Line 1)


-
-

setPlotLine
Manual code way to set Plot Lines (not necessary if pre-defined design time
Plot Lines are configured in the Property Browser (see the PlotLineCollection
property)


Various (7 Overloads)



____________________________________________________________________________
Derrick Coetzee said:
Derrick said:
Does anyone know of a downloadable Line ActiveX control which allows me
to plot straight lines on a VC++.NET form?

I'm not sure exactly what you have in mind, but you should be able to draw
simple straight lines on a form using Control::CreateGraphics() and
Graphics::DrawLine() as follows: [ snip ]

Yes. Though, I need to draw the lines visually at design time

If it's only horizontal and vertical lines you're interested in, you might
check out this article:

http://msdn.microsoft.com/library/d...vxconchangestolinecontrolinvisualbasicnet.asp

Although it references VB.NET, the controls are the same in every .NET
language and the same trick should work:

"During upgrade, vertical or horizontal Line controls are replaced with the
Windows Forms Label control, with the Text property set to an empty string,
the BorderStyle property set to none, and the BackColor, Width, and Height
properties set to match the original control."

If you're looking instead to draw lines of arbitrary slope, unfortunately I
haven't found anything to do this, but if you're interested I could whip
something up.
 
tsda said:
Derrik:
Ironic Process (low cost) (and graphics server.com-high cost)) have nice
Graphics server engines that can be added to a form in vc++.net via this
added toolbox plugin, and nicely complements the existing toolbox in
vc++.NET. I can't get them hooked up to read file data and update in real
time as a file changes. It's easy to load the server to a form but I'm stuck
on these real simple looking Ironic.ChartControl namespace method calls
below. Can you help/recommend? Info below. Thanks, Mike

Sorry for the slow response. I'm afraid I'm not familiar with this
company's technology and don't have access to it, but if you can describe
in more detail in what way you're stuck and what might help you make
progress, I might be able to help.
 
Derrick:
All the company provides is in my email. Cool applett but no supporting code
or samples. Do you know of a vc++ form ready for graphics that I can drop in
code to handle a file that gets updated in real time without having to write
one?
Thanks, Mike
 
Mike Barna said:
All the company provides is in my email. Cool applett but no supporting code
or samples. Do you know of a vc++ form ready for graphics that I can drop in
code to handle a file that gets updated in real time without having to write
one?

Sorry again for the slow response. I'm not sure exactly what you're trying
to do, but if you only want to draw things based on a file's contents at
runtime, you can use either the GDI methods on Graphics, such as DrawLine(),
or use a DirectX control. If you're trying to draw a chart based on some
data in the file and update it in real-time, you should be able to use just
about any chart control to do this, such as the MSChart control. I hope this
helps.
 
Back
Top