|
All you need to do is store the two doubles that you're using as parameters to class variables, so that you can use them every time you get a paint event, and perhaps define a bool to say if those values are valid or not ( so you don't always call it ).
1. I'm not sure what you mean. declaration and definition are together in C#, not like C++
2. An event has the signature void NAME(object, EventArgs)
3. If you want to define and not declare a method, the closest you can get is to use delegates. You don't need them here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've asked this a few times, but I'm a little dense on what I'm really trying to do.
1.I have a Button Event, (say On_Btn_dblClick...)
2.On_Btn_dblClick(object sender, System.EventArgs e)
{
Inside HERE is some code that will draw lines
using numbers from TextBoxes to draw a line
inside a RectF that is on my Form1
}
Here's the problem. When I change the numbers inside the
TextBoxes and then click the On_Btn.. again, another line
is drawn in the RectF BUT the original line stays on the Form1
3.I have a number of funcs in my Form1_Paint handler
to draw a RectF and to draw axes and labels inside the RectF
but can't figure out how to clear the line on the Form1
if I reset the Text Boxes and On_Btn click again.
Someone had suggested using Clear(); method BUT clear WHAT and WHERE? The RectF
or Form1 or the Graphics g?
--thanks
|
|
|
|
|
The way you typically setup a form application you do all your drawing in paint.
In your button double click event you should change your application state and then call invalidate which will cause paint to run.
At the beginning of paint you want to clear whatever region you are going to paint and then do all the drawing for that region.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Here's the code.....thanks...
///////////////////////
private void complexA_OK_Click(object sender, System.EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen cmplxAPen = new Pen(Color.Crimson);
//
try
{
Invalidate();
double valAReal;
double valAComplex;
valAReal = Convert.ToDouble(this.textComplexAReal.Text);
valAComplex = Convert.ToDouble(this.textComplexAComplex.Text);
DrawComplexNumber(g, valAReal, valAComplex);
}
catch
{
MessageBox.Show("Invalid Complex A Number", "Error!");
}
}
///////////////////////////////////////////////
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawGraphRectF(e.Graphics);
DrawXYAxes(e.Graphics);
DrawGraphXandYTicks(e.Graphics);
}
////////////////////////////////////////////////
void DrawComplexNumber(Graphics g, double re_, double im_)
{
Pen cmplxPen = new Pen(Color.DarkGray, 4);
g.DrawLine(cmplxPen, (xIndent + graphRect.Width/2), (yIndent + graphRect.Height/2), (xIndent + graphRect.Width/2) + (float)(re_ * xIndent), (yIndent + graphRect.Height/2) - (float)(im_ * yIndent));
//Pen cmplxEraseLinePen = new Pen(Color.Snow, 4);
//g.DrawLine(cmplxEraseLinePen, (xIndent + graphRect.Width/2), (yIndent + graphRect.Height/2), (xIndent + graphRect.Width/2) + (float)(re_ * xIndent), (yIndent + graphRect.Height/2) - (float)(im_ * yIndent));
}
|
|
|
|
|
private bool mShowValue = false;
private double mValReal;
private double mValComplex;
private void complexA_OK_Click(object sender, System.EventArgs e)
{
try
{
mShowValue = true;
mValReal = Convert.ToDouble(this.textComplexAReal.Text);
mValComplex = Convert.ToDouble(this.textComplexAComplex.Text);
Invalidate();
}
catch
{
MessageBox.Show("Invalid Complex A Number", "Error!");
}
}
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawGraphRectF(e.Graphics);
DrawXYAxes(e.Graphics);
DrawGraphXandYTicks(e.Graphics);
if (mShowValue)
{
Pen cmplxAPen = new Pen(Color.Crimson);
DrawComplexNumber(e.Graphics, mValReal, mValComplex);
}
}
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
SOLVED
-- modified at 19:58 Wednesday 7th September, 2005eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
-- modified at 19:40 Wednesday 7th September, 2005
|
|
|
|
|
maybe you mean...
szMyQuery.AppendFormat("SELECT User.Username, User.Password FROM [User] WHERE (((User.Username)='{0}'))", szQUser);
You arent putting the value of szQUser into the sql, but literally "szQUser"!
Better still, use a SqlParameter to add the username to the SQL.
Hope this helps
Philip Cole
|
|
|
|
|
Ahh!
Made that mistake before!!!!
Thanks a bunch man.
|
|
|
|
|
Is there a way to have Windows notify a c# program about time changes? I'd like my program to be notified every hour on the hour and I don't really want to use a timer for this. Is this possible?
Thanks.
- Aaron
|
|
|
|
|
Hi, I new to know the following:
1. Can I use my snk files in any place after made? I want to distribuite my dll iand I will add snk as content file in my setup program.
2. How can I write the AssemblyKeyFile if I have the snk file in the same folder of my dll
If I write [assembly: AssemblyKeyFile("TransCOM.snk")] gives me an error.
I put in my proyect folder and write [assembly: AssemblyKeyFile("..\\..\\TransCOM.snk")] and works fine
Than you!!!!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I have anothe one:
3. If I use remoting (singlecall or singleton clone) and my transaccion class is in the server where do I need to to put the snk file?
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Hello All,
I developed a Com+ component and i need to setup it to work as a webservice. when i trying to activat in the control panel - component servie. the soap option deactive
please any one know any docs about his issue.
Regards,
hay
|
|
|
|
|
Here's a simplified version of my problem:
I have a TreeView. Each TreeNode in the TreeView represents the file bytes stored in a remote database.
I'd like to drag a TreeNode out of my program and drop it into Windows Explorer as a file. I can do this using the DataObject.SetFileDropList method in .NET 2.0. However, SetFileDropList takes a list of strings which are paths to the files you want to drop. Unfortunately, the "files" I want to drop aren't actual files; they're bytes located in a remote database. Now, I have code that can download the bytes of the file...but I want to do this only when the file is dropped into a Windows Explorer folder.
I want Windows Explorer to accept the drop as a file, yet the file contents will need to be downloaded from the remote database, I imagine, when the file is actually dropped into a Windows Explorer folder. Basically, I'm trying to drag file contents, rather than actual files. How can I do this?
*edit* To put it in even simpler terms, what I'm trying to do is drag a Stream of bytes into Windows Explorer to be dropped as a file. Possible?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
|
I am trying to figure out how to receive a copy of the packets on
an established Tcp connection locally on 127.0.0.1 (localhost).
can tapping into "kernel32.dll" work?
any suggestions will be appreciated.
"hello"
|
|
|
|
|
I don't know if kernel32.dll helps or not.
But I know that it is not a *standard* operation. You have to use some system hooks.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
I don't know if kernel32.dll helps or not.
But I know that it is not a *standard* operation. You have to use some system hooks.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
any suggestions on how to do it? or maybe you can point me to the right place
to read about the "how"?
thank you.
"hello"
|
|
|
|
|
Try this article: it is about packet sniffing
I think it should be the solution
Packet Capture and Analysis
bye
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
Well!
I Need some help on using verifinger sdk 4.2 while working with digital persona scanner. is there any body who is using or has used this SDK i need some help
I M new in .net p
|
|
|
|
|
i'm getting some trouble dividing 2 double values:
double a = 1.0;
double b = 7.0;
double x = a/b;
x having to be 0,14... instead it is 0.0 WHY?
|
|
|
|
|
Your example doesn't demonstrate the problem.
using System;
class Test
{
static void Main(string[] args)
{
double a = 1.0;
double b = 7.0;
double x = a/b;
Console.Write(x);
Console.Read();
}
}
Outputs 0.14...
Your problem sounds like a and b are integers, in which case integer division will be carried out, resulting in 0 and the 0 being cast to a double.
|
|
|
|
|
i dunno but that is my code, these are double but the result is 0.0
What could be happened?
|
|
|
|
|
You've messed something up in the code. I tried the same thing in C# 2003 and 2005 and couldn't replicate your results. Perhaps copy/pasting the code will help?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need to get the .exe name within the same application running...
I've tried to use Application.ExecutablePath but the whole Application class doesn't work inside my console application.
So how can i do?
|
|
|
|