|
Deja Vu all over again. The 3rd time this user has asked the same question
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Just found some of his attempts to ask this, earliest one dates August 10[^]!
|
|
|
|
|
That´s the reason why MS made it "difficult" to use unsafe code ...
|
|
|
|
|
|
How kind of him to give you advance notice, so you could perform all necessary research in time...
|
|
|
|
|
Guess they are just trying until getting an answer they like.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have a multithreaded application with a few background thread polling various URLs.
When testing, it often happen that the URL are not working, and if I break on all exception I keep jumping to this annoying thread (and losing track of what I'm currently debugging)
I tried to "freeze" them, but they keep popping up!
Am I missing something?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
|
No, I haven't!
But I will!
Thanks.
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
If this isn't the right place for this question please let me know.
I was playing with one of the samples Multi Y Graph. I added a couple of varibles and execute it 4 different times via mouse click.
The first time through all works as expected. The second time through the x and y axis work correctly but the 3rd and 4th do not.
Can anyone point me in the right direction.
Here is the code I am using...
public partial class Form1 : Form
{
private static int clickCount = 0;
private LineItem myCurve;
public Form1()
{
InitializeComponent();
}
#region Graph Test
public void CreateChart(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
myPane.Title.Text = "Demonstration of Multi Y Graph";
myPane.XAxis.Title.Text = "Time, s";
myPane.YAxis.Title.Text = "Velocity, m/s";
myPane.Y2Axis.Title.Text = "Acceleration, m/s2";
PointPairList vList = new PointPairList();
PointPairList aList = new PointPairList();
PointPairList dList = new PointPairList();
PointPairList eList = new PointPairList();
for (int i = 0; i < 30; i++)
{
double time = (double)i;
double acceleration = 2.0;
double velocity = acceleration * time;
double distance = acceleration * time * time / 2.0;
double energy = 100.0 * velocity * velocity / 2.0;
aList.Add(time, acceleration);
vList.Add(time, velocity);
eList.Add(time, energy);
dList.Add(time, distance);
}
if (clickCount == 1)
{
LineItem myCurve = myPane.AddCurve("Velocity",
vList, Color.Red, SymbolType.Diamond);
myCurve.Symbol.Fill = new Fill(Color.White);
myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsOpposite = false;
myPane.YAxis.MajorGrid.IsZeroLine = false;
myPane.YAxis.Scale.Align = AlignP.Inside;
myPane.YAxis.Scale.Max = 100;
}
if (clickCount == 2)
{
myCurve = myPane.AddCurve("Acceleration",
aList, Color.Blue, SymbolType.Circle);
myCurve.Symbol.Fill = new Fill(Color.White);
myCurve.IsY2Axis = true;
myPane.Y2Axis.IsVisible = true;
myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Blue;
myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
myPane.Y2Axis.MajorTic.IsOpposite = false;
myPane.Y2Axis.MinorTic.IsOpposite = false;
myPane.Y2Axis.MajorGrid.IsVisible = true;
myPane.Y2Axis.Scale.Align = AlignP.Inside;
myPane.Y2Axis.Scale.Min = 1.5;
myPane.Y2Axis.Scale.Max = 3;
}
if (clickCount == 3)
{
myCurve = myPane.AddCurve("Distance",
dList, Color.Green, SymbolType.Square);
myCurve.Symbol.Fill = new Fill(Color.White);
myCurve.YAxisIndex = 1;
YAxis yAxis3 = new YAxis("Distance, m");
myPane.YAxisList.Add(yAxis3);
yAxis3.Scale.FontSpec.FontColor = Color.Green;
yAxis3.Title.FontSpec.FontColor = Color.Green;
yAxis3.Color = Color.Green;
yAxis3.MajorTic.IsInside = false;
yAxis3.MinorTic.IsInside = false;
yAxis3.MajorTic.IsOpposite = false;
yAxis3.MinorTic.IsOpposite = false;
yAxis3.Scale.Align = AlignP.Inside;
}
if (clickCount == 4)
{
myCurve = myPane.AddCurve("Energy",
eList, Color.Black, SymbolType.Triangle);
myCurve.Symbol.Fill = new Fill(Color.White);
myCurve.IsY2Axis = true;
myCurve.YAxisIndex = 1;
Y2Axis yAxis4 = new Y2Axis("Energy");
yAxis4.IsVisible = true;
myPane.Y2AxisList.Add(yAxis4);
yAxis4.MajorTic.IsInside = false;
yAxis4.MinorTic.IsInside = false;
yAxis4.MajorTic.IsOpposite = false;
yAxis4.MinorTic.IsOpposite = false;
yAxis4.Scale.Align = AlignP.Inside;
yAxis4.Type = AxisType.Log;
yAxis4.Scale.Min = 100;
}
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
zgc.AxisChange();
zgc.Invalidate();
}
#endregion
private void toolStripButton1_Click(object sender, EventArgs e)
{
if (clickCount > 4 || clickCount == 4)
{
clickCount = 1;
}
else
{
clickCount = clickCount + 1;
}
CreateChart(zgc);
}
}
thanks in advance
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
-- Modified Sunday, December 12, 2010 12:28 PM
|
|
|
|
|
Read How to get an answer to your question[^] and with attention to #7. Following these guidelines will get better responses to your questions
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
thanks for the tip
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Did you find the solution for keeping the size of your GraphPane?
If not, here is it:
You need 2 floats
private float myHeight = 0;
private float myWidth = 0;
and in your CreateChart, right after
GraphPane myPane = zgc.GraphPane;
you add:
if (myHeight == 0)
{
myWidth = myPane.Rect.Size.Width;
myHeight = myPane.Rect.Size.Height;
}
else
{
if (myPane.Rect.Size.Width < myWidth)
{
myPane.Rect = new RectangleF(0, 0, myWidth, myHeight);
}
}
|
|
|
|
|
Thank you Thomas. I was using a different work around but I like this way better.
Thanks again for your time and expertise.
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Try this in your button click event:
clickCount++;
if (clickCount > 4)
{
clickCount = 1;
zgc.GraphPane = new GraphPane();
}
CreateChart(zgc);
some work with the pane size remains ...
|
|
|
|
|
That did it...Thanks so much for your time
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
|
I have a simple application with a timer (interval 5min) to read the simple data from mysql server.. The application is just one form but it's freezing after the code runs! why is that?
here is the full code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Configuration;
using System.Threading;
namespace Cure_Server
{
public partial class frmMain : DevExpress.XtraEditors.XtraForm
{
MySqlConnection sql_connection = null;
MySqlCommand sql_command = null;
MySqlDataAdapter sql_adapter;
DataTable data_table = null;
MySqlDataReader sql_reader = null;
DataSet data_set = null;
public public_class public_var = new public_class();
const int MF_BYPOSITION = 0x400;
[DllImport("User32.dll")]
private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlagS);
[DllImport("User32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("User32.dll")]
private static extern int GetMenuItemCount(IntPtr hWnd);
public int result_rows;
public frmMain()
{
InitializeComponent();
}
private void perform()
{
get_statistics_summary();
send_sms();
}
private void get_statistics_summary()
{
progressRunning.Visible = true;
try
{
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("SELECT COUNT(*) AS total_files FROM persons", sql_connection);
sql_command.CommandType = CommandType.Text;
sql_reader = sql_command.ExecuteReader();
if (sql_reader.Read())
{
lblTotalFiles.Text = sql_reader["total_files"].ToString();
}
sql_reader.Close();
sql_command = new MySqlCommand("SELECT COUNT(*) AS total_appointments FROM appointments", sql_connection);
sql_command.CommandType = CommandType.Text;
sql_reader = sql_command.ExecuteReader();
if (sql_reader.Read())
{
lblTotalAppointments.Text = sql_reader["total_appointments"].ToString();
}
}
catch (Exception exp)
{
return;
}
finally
{
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
progressRunning.Visible = false;
}
private void send_sms()
{
progressRunning.Visible = true;
try
{
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("sp_send_pending_sms", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_reader = sql_command.ExecuteReader();
while (sql_reader.Read())
{
lblTimer.Text = sql_reader["sms_queue_id"].ToString();
}
}
catch (Exception exp)
{
return;
}
finally
{
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
progressRunning.Visible = false;
}
private void frmMain_Load(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
IntPtr hMenu = GetSystemMenu(this.Handle, false);
int menuItemCount = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, menuItemCount - 1, MF_BYPOSITION);
timerMain.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["ServerTimerInterval"]);
}
private void btnEmailTemplates_Click(object sender, EventArgs e)
{
frmEmailTemplates EmailTemplatesForm = new frmEmailTemplates(public_var);
EmailTemplatesForm.ShowDialog();
}
private void frmMain_Shown(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
timerMain.Start();
this.Cursor = Cursors.Default;
}
private void btnConnectonFile_Click(object sender, EventArgs e)
{
}
private void timerMain_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
backgroundWorkerSMS.RunWorkerAsync();
}
private void btnOptions_Click(object sender, EventArgs e)
{
timerMain.Stop();
frmOptions OptionsForm = new frmOptions();
DialogResult options_form = OptionsForm.ShowDialog();
if (options_form == DialogResult.OK)
{
timerMain.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["ServerTimerInterval"]);
}
timerMain.Start();
}
private void backgroundWorkerSMS_DoWork(object sender, DoWorkEventArgs e)
{
timerMain.Stop();
perform();
}
private void backgroundWorkerSMS_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
backgroundWorkerSMS.Dispose();
timerMain.Start();
}
}
}
|
|
|
|
|
jrahma wrote: progressRunning.Visible = true;
jrahma wrote: lblTimer.Text = ...
jrahma wrote: lblTotalAppointments.Text =
study me[^]
|
|
|
|
|
Given that previously you have posted very basic question and this recent post (http://www.codeproject.com/Messages/3695788/app-Config-deployment.aspx[^]) where you don't even know how to use the app.config file I very much doubt this is even your code. If I'm incorrect, then I apologize, yet the facts don't seem to add up.
As has been noted before you have asked a considerable amount of basic questions and you have been given the advice to read some books or take a class and learn the basics properly, not stumbling around. Please take this advice.
We are here to help, yet it gets very annoying to be peppered with such basic questions time and time again when you should take some responsibility to learn the trade.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hear hear.
|
|
|
|
|
Hi,
it's working fine now.. Thanks BUT there is another problem related to the CPU usage..
I posted the problem here:
http://www.codeproject.com/Messages/3696614/CPU-jumps-from-16-to-78.aspx
Thanks
|
|
|
|
|
Did you even read my response? Apparently not. Stop asking questions here and go learn.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello,
I'm using a 3rd party that uses log4net in order to log its messages.
I'm interested only on those messages that do not include "UnwantedTextExample".
How can I configure the config.log4net in order to not log those messages?
Thanks,
Berlus
|
|
|
|
|
I work with some legacy applications that still log to flat file with log4net as well. As I can't change the logging from the source side, I have resorted to opening the logs in Excel(as ours are comma delimited) and then I simply use the data processing features (Sorting and Filter) to find the entries I'm interested in. It can be quite frustrating, I know, but that's why we've been converting everything to use database error logging instead.
I wasn't, now I am, then I won't be anymore.
|
|
|
|