|
AFAIK CustomLineCap is the only way. I know it is difficult to get it working.
Maybe you can try to draw *manually* the arrow by filling a Shape.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
I thought the manual way. But you know the slope of the line changes sharply and the arrow has to change. So it needs much calculation work and I doubt if the effect is good.
Radic
|
|
|
|
|
Another RAW way:
1. draw the line only (without arrows)
2. apply a scale to the Graphics object (ScaleTransform)
3. Draw a short line (few pixels long) with the default arrow cap.
you should try and try to get the correct scale and 2nd line's length.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
In what way is the CustomLineCap class troublesome? I think that it probably is the easiest way to do it, so any other method would be even more troublesome.
---
b { font-weight: normal; }
|
|
|
|
|
Any easier way? Before you construct a CustomLineCap, you need construct GraphicsPath, FillMode, etc, which, I think, is troublesome. Will you be kind enough to show me an easier way? Thanks, thanks, thanks!
Radic
|
|
|
|
|
yeah, I have a datagrid control on a form. How do I do a simple binarysearch on the table so I can select the row that results were found in. thanks. also, is there a way I can make rows invisible so they still exist, but aren't visible? thanks so much.
Stephen
also, in this datagrid, I'm displaying id3 information about mp3's using a library I found online. it works well, but when I display the information it outputs in the datagrid, I get many of these strange symbols that look like a square. I exporte dthe datagrid as an xml file and found the squarex to be represented by & # x 0 ; minus the spaces. I can also paste this sequence here without spaces and it will show the odd symbol: . I read somewhere that this is represents null characters. However, tooltips on the datagrid show the proper contents of the cells, just the actual cells contents have those weird symbols. any ideas? thanks
-- modified at 22:42 Wednesday 7th September, 2005
|
|
|
|
|
Hi Buddy, I am also looking for this kind of information. So if you found any help please tell me.Thanx
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Here's the code..... If anyone can tell me how to get the form to erase the previous line when I click the ok button. I'd appreciate it. Each time I click the "OK" button it just draws line after line w/ out erasing the previous line....thanks...
///////////////////////
//BLOCK 1:
private void complexA_OK_Click(object sender, System.EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen cmplxAPen = new Pen(Color.Crimson);
//
try
{
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!");
}
}
///////////////////////////////////////////////
//BLOCK 2:
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawGraphRectF(e.Graphics);
DrawXYAxes(e.Graphics);
DrawGraphXandYTicks(e.Graphics);
}
///////////////////////////////////////////////
//BLOCK 3:
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));
}
[Reply][View Thread][Get Link] [Modify|Delete
|
|
|
|
|
Where do you call DrawComplexNumber ? It should be called from the Paint handler. The OK click handler should force a paint by calling Invalidate(). Which is exactly what Andy said.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian, thanks. Starting to understand...
I call DrawComplexNumber within the namespace of Form1.cs as a function defintion. Within the Button_Click event it is called (i.e. declared).
That being said.....how to integrate all these things between the three?
1. Paint handler:
How to DECLARE (not define) an event as in "Button_Click"?
2. Button_Click event:
What the heck to I put between the braces?
3. DrawComplexNumber:
Again, where to DEFINE, and where to DECLARE?
thanks again
|
|
|
|
|
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"
|
|
|
|