取二維技巧
m(Rect(p1,p2));
m(Range(rx,ry) , Range(cx,cy));
全範圍可以用 Range::all()
或乾脆這樣做
m.rowRange(rx,ry);
m.colRange(cx,cy);
取一條線技巧
m.row(r).colRange(cx,cy);
m.col(c).rowRange(rx,ry);
取一點
m.data[x*step + y] (效率較高,但無邊界判斷)
m.at(x,y)
using System.IO.Pipes;
using (NamedPipeServerStream pipeStream = new NamedPipeServerStream("mypipe"))
{
pipeStream.WaitForConnection();
StreamReader sr = new StreamReader(pipeStream);
string tmp;
while ((tmp = sr.ReadLine()) != null)
pipeMsg.Text += tmp + "\r\n";
}
#include <windows.h>
#include <stdio.h>
hFile = CreateFile("//./pipe/mypipe", GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE , NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
DWORD dw = GetLastError();
printf("CreateFile failed for Named Pipe client\n:" );
break;
}
else
{
flg = WriteFile(hFile, s.c_str(), s.length(), &dwWrite, NULL);
if (FALSE == flg)
printf("WriteFile failed for Named Pipe client\n");
CloseHandle(hFile);
}
C#已經把windows的named pipe API包得好好的,因此程式碼看起來比較平易近人。//./pipe/
double[] data1 = { 1, 3, 5, 7, 9, 11 };
double[] data2 = { 2, 4, 6, 8, 10, 12 };
double[] data3 = { 5, 2, 6, 7, 5, 2 };
BarItem myBar; //長條圖
myBar = zedGraphControl1.GraphPane.AddBar("資料1", null, data1, Color.Red);
myBar.Bar.Fill = new Fill(Color.Red, Color.White, Color.Red);
myBar = zedGraphControl1.GraphPane.AddBar("資料2", null, data2, Color.Green);
myBar.Bar.Fill = new Fill(Color.Green, Color.White, Color.Green);
myBar = zedGraphControl1.GraphPane.AddBar("資料3", null, data3, Color.Purple);
myBar.Bar.Fill = new Fill(Color.Purple, Color.White, Color.Purple);
LineItem myCurve; //折線圖
myCurve = zedGraphControl1.GraphPane.AddCurve("資料1", null, data1, Color.Red);
myCurve.Line.Fill = new Fill(Color.Red, Color.White, Color.Red);
myCurve = zedGraphControl1.GraphPane.AddCurve("資料2", null, data2, Color.Green);
myCurve.Line.Fill = new Fill(Color.Green, Color.White, Color.Green);
myCurve = zedGraphControl1.GraphPane.AddCurve("資料3", null, data3, Color.Purple);
myCurve.Line.Fill = new Fill(Color.Purple, Color.White, Color.Purple);
string[] xTitle = { "1", "2", "3", "4", "5", "6" }; //X軸的刻度資料
zedGraphControl1.GraphPane.XAxis.Scale.TextLabels = xTitle;
zedGraphControl1.GraphPane.XAxis.Type = AxisType.Text;
zedGraphControl1.GraphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F);
zedGraphControl1.GraphPane.Fill = new Fill(Color.FromArgb(250, 250, 255));
zedGraphControl1.AxisChange();
zedGraphControl1.Refresh();
zedGraphControl1.GraphPane.CurveList.Clear();//把舊的圖資清掉