Jump to content
Sign in to follow this  

Проблема с NPlot в GTK#

Recommended Posts

При использовании библиотеки NPlot.dll в среде MonoDevelop возникает проблема.

Так выглядит файл MainWindow.cs:

using System;using Gtk;using NPlot.Gtk;using NPlot;using System.Drawing;using System.Drawing.Imaging;using System.Collections.Generic;using System.Threading;public partial class MainWindow: Gtk.Window{        public  NPlot.Gtk.PlotSurface2D Plot = new NPlot.Gtk.PlotSurface2D();        public List<int> A =new List<int>();        public Random Rand = new Random();        public static Thread MyThread;        public MainWindow (): base (Gtk.WindowType.Toplevel)        {                Build ();                this.frame.Add(Plot);                A.Add(1);                A.Add(2);                A.Add(4);                DrawPlot(A);                Plot.WidthRequest=400;                Plot.HeightRequest=300;                Plot.Show();        }        public void DrawPlot(List<int> Line)        {                Plot.Clear();                LinePlot lp = new LinePlot(A);                lp.DataSource = Line;                Plot.Add( lp );        }        public void Run()        {                for(;                {                        Thread.Sleep(300);                        A.Add(Rand.Next(10));                        DrawPlot(A);                        Plot.Refresh();                }        }        protected void OnButtonClicked (object sender, System.EventArgs e)        {                MyThread = new Thread(new ThreadStart(Run));                MyThread.Start();        }}

После нескольких удачных циклов программа перестает отрисовывать окно. Если растянуть окно мышью, то прорисовка продолжается, а потом снова останавливается.

С чем может быть связана проблема? Или ЧЯДНТ?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...