コード例 #1
0
    //==================ZEDGRAPH=================
    void OnIvFtpBrowserItemActivated_ZedGraph(object o, ItemActivatedArgs args)
    {
        string selected_file = get_BrowserItem_Value (ivFtpBrowser);
        StreamReader file_reader = c_current_ftp_session.CFTP_GetFile (selected_file);

        Viewport _port = new Viewport (new Adjustment(1000, 500, 1000, 5, 0, 500),
            new Adjustment (500, 500, 500, 0, 0, 500));
        _port.WidthRequest = 2000;
        _port.ResizeMode = ResizeMode.Parent;

        ZedGraphControl g_graph = new ZedGraphControl ();

        c_current_logfile = new CLogFile
                            (
                                file_reader,
                                c_current_ftp_session.CFTP_LogFileDate,
                                c_current_device.DeviceFileDescription
                               );

        c_current_graph = new CGraph (c_current_logfile.LogFileEntries);
        //c_current_graph.YAxisCodeIndex = c_current_logfile.CLogFile_Get_Y_Axis_Code_Index (c_current_device);
        c_current_graph.Title = selected_file;
        c_current_graph.YAxisCode = "CURTEMP";
        c_current_graph.YAxisLabel = "Current Temperature";
        c_current_graph.XAxisLabel = "Time Stamp";
        c_current_graph.CGRAPH_X_AxisData = c_current_logfile.LogFileTime;
        c_current_graph.CGRAPH_Y_AxisData = c_current_logfile.LogFileTemps;

        //Plot Graph
        c_current_graph.ploy_zedgraph (out g_graph);
        System.Drawing.Bitmap bmp_graph =
            new System.Drawing.Bitmap (g_graph.Width, g_graph.Height);

        g_graph.DrawToBitmap(bmp_graph,
            new System.Drawing.Rectangle(0, 0, g_graph.Width, g_graph.Height));

        bmp_graph.Save ("graph.bmp");

        img_graph.ModifyBg (StateType.Normal, CUtil.get_light_grey ());
        img_graph.ModifyBase (StateType.Normal, CUtil.get_light_grey ());
        img_graph.File = "graph.bmp";
        img_graph.QueueDraw ();
        img_graph.ShowAll ();

        /**
         * Fill Alarms Table
         */

        FillAlarmsTable (c_current_logfile.LogFileAlarms);

        file_reader.Close ();
        file_reader.Dispose ();

        nbFrames.CurrentPage = (int)nb_Notebook_Pages.GRAPH;
    }