Jump to content

Autoit create System.Drawing.Color object


Sucre
 Share

Recommended Posts

Now I want to use a dll function, It needs a para that is a ARGB Color Struct in System.Drawing.dll

Using C# is very easy:

double[] x = new double[100];

double[] y = new double[100];

......
objChart.GraphPane.AddBar( "Sine Wave", x, y, System.Drawing.Color.Red );
 

but using autoit, it seems difficult to create such a ARGB color struct because I can't know its structure:

Local $x[3] = [1.0, 2.0, 3.0], $y[3] = [11.0, 12.0, 13.0]

$objChart.GraphPane.AddBar("Sine Wave",$x,$y, ?????????)

The Color.Red is defined in the System.Drawing.dll,   i.e.  System.Drawing.Color.Red

Is there some solution? Any help will be greatly appreciated ~

Link to comment
Share on other sites

43 minutes ago, JohnOne said:

AutoIt does not access .Net. It employs the win32 API.

Thank you!

That is, It also can't be created by DllCall or some AutoIt function else ? Because I can put the System.Drawing.dll in my script directory ...

I have no idea about the difference about .NET and Win32 API

Edited by Sucre
supplement
Link to comment
Share on other sites

GDI / GDI+ might help you.

 

Can you show me a screenshot how it looks using C#?

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

16 minutes ago, UEZ said:

GDI / GDI+ might help you.

 

Can you show me a screenshot how it looks using C#?

Thank you! Many of your replies help me a lot for my study, and your potrait is so impressive!

The C# is very easy. I just use the ZedGraph.dll---to create Chart,

the main code in the project created by Visual Studio:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using ZedGraph;

......

private ZedGraph.ZedGraphControl z1;

this.z1 = new ZedGraph.ZedGraphControl();

......

z1.IsShowPointValues = true;
z1.GraphPane.Title = "Test Case for C#";
double[] x = new double[100];
double[] y = new double[100];
 int    i;
for ( i=0; i<100; i++ )
{
     x = (double) i / 100.0 * Math.PI * 2.0;
     y = Math.Sin( x );
}
z1.GraphPane.AddBar( "Sine Wave", x, y, System.Drawing.Color.Red );
z1.AxisChange();
z1.Invalidate();

It's a demo in the open project ---ZedGraph ,I want to make it a UDF if possible.

I'm not familar with GDI and I will learn

Thank you~

Link to comment
Share on other sites

34 minutes ago, UEZ said:

GDI / GDI+ might help you.

 

Can you show me a screenshot how it looks using C#?

It's too late now, And I must go to bed. See you ^^

p.s. the relative help file, ARGB Color struct is necessary almost in any similar function

public BarItem AddBar(
	string label,
	double[] x,
	double[] y,
	Color color
)
public LineItem AddCurve(
	string label,
	double[] x,
	double[] y,
	Color color
)
Link to comment
Share on other sites

I meant rather a screenshot from the result rather than from the C# code.

 

Anyhow, this might help you: GraphGDIPlus UDF - Create GDI+ line graphs

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Quote
double[] x = new double[100];
double[] y = new double[100];
 int    i;
for ( i=0; i<100; i++ )
{
     x = (double) i / 100.0 * Math.PI * 2.0;
     y = Math.Sin( x );
}

 

That does not make any sense to me.

x is an array of double, and you are assigning the array a value of double.

If you provide incorrect code, you will find it difficult to get help.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

18 hours ago, JohnOne said:

That does not make any sense to me.

x is an array of double, and you are assigning the array a value of double.

If you provide incorrect code, you will find it difficult to get help.

Yeah, It does make no sense to you, so I just omitted it in the topic, I am a green hand and what I face should be simple, I think you might complicate it.

Anyway, thank you~ your first reply maybe just what I want. I have searched so much after all and can't find a better solution

Link to comment
Share on other sites

19 hours ago, UEZ said:

I meant rather a screenshot from the result rather than from the C# code.

 

Anyhow, this might help you: GraphGDIPlus UDF - Create GDI+ line graphs

http://progandy.de/downloads/viewdownload/3-autoit-udfs/8-rmchart-gdi-chart-control.html

It's RMChart.au3 which is exactly what I need. The author make RMChart.dll a UDF. And I have made something using it, but I found it's not flexible enough. So I want to make a powerful one myself. I also need this kind to simplify my boring job. That's all. I have searched a lot and I am afraid this is it. It's very kind of you! Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...