|
Its working. Thank you Thank you.;)
Nana
|
|
|
|
|
Here is my problem. I'm trying to draw a vector on a graph on a WinForm.
I want an arrow (triangle) on the end of the line. I have two files.
My pens are "cycled" on each paint event (0, 1, 2.. repeat). Everything works ok. I just can't seem to figure out how to draw an arrow....
Complex.cs
///////////////////////////////////////
private double x
private double y
//Constructor
public Complex()
{
x = 0;
y = 0;
}
public Complex( double _x, _y)
{
x - _x;
y = _y;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////Form1.cs
public Pen[] activePen = new Pen[] { new Pen( Color.Blue, 2 ), new Pen( Color.Green, 2 ), new Pen(Color.Red, 2) };
private int _penIndex = -1;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
private Pen GetNextPen()
{
_penIndex = (_penIndex + 1) % 3;
return activePen[_penIndex];
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
g.DrawLine(GetNextPen(), 250, 250, x, y );
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Look at the Pen.EndCap property. There is an enumeration that will allow you to put arrows on your line.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Andy . Thanks. My problem is I can't figure out HOW to put the code in.
Where would it go?
|
|
|
|
|
Pen p = new Pen( Color.Blue );<br />
<br />
p.EndCap = System.Drawing.Drawing2D.LineCap.Triangle<br />
You need to do this for the pens that you want to have a cap.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Have you read what I wrote you?
I gave you the code and I said you could place it in the constructor...
|
|
|
|
|
Sorry - I'm new to this. WHICH Constructor? The Form or the Complex class?
Thanks.
|
|
|
|
|
In the constructor of the class where the Pen array field is defined and being used.
|
|
|
|
|
I'm starting up on big project that will take much of my time in next year or two. Until now I was mostly self-employed on small projects so I didn't spent so much time modeling system before implementation. Sure, I wrote use cases now and then, draw UML in Visio but it wasn't matter of life and death.
But because of scope in next project I'm kinda frighten that sooner or latter I along my team will get lost in poorly documentet envoirement where no one will know what is truly purpose of system's part that they are working on or how to connect it to another.
So, since lot of envisioning and planning are up ahead I was thinking about sharing tought or two regarding UML modeling, drawing use case diagrams and similar subject. What programs for creating solution architecture you people recommend? I'm in need of something that can truly succesfuly reverse-engeenier and forward-engeneer (UML <-> C#.NET solution). What are your views on 2005 generation of tools (VS.NET 2005 with Visio 2005) that are comming next month? Anyone played long enough with Beta?
Tnx!
|
|
|
|
|
How can I rotate a picturebox? Not just the image inside, but the box as well. I want to rotate the WHOLE control. Any help would be great. Thanks.
D
|
|
|
|
|
I don't think it's possible...
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
|
I need to alter a C# Windows application to be a C# Web application.
From the documentation I have read that IIS needs to be installed on the development machine to effect this. Is this true ?
I don't have IIS installed as I use Apache. Can this be made to work ?
Regards,
Alf Stockton
|
|
|
|
|
StrayGrey wrote:
I need to alter a C# Windows application to be a C# Web application
=> it's not easy
StrayGrey wrote:
From the documentation I have read that IIS needs to be installed on the development machine to effect this. Is this true ?
Yes
StrayGrey wrote:
I don't have IIS installed as I use Apache. Can this be made to work ?
I'm not sure. just try it
<< >>
|
|
|
|
|
I need to alter a C# Windows application to be a C# Web application.
From the documentation I have read that IIS needs to be installed on the development machine. Is this true ?
I don't have IIS installed as I use Apache. Can this be made to work ?
Regards,
Alf Stockton
|
|
|
|
|
|
Ok, so here is the problem. I'm working on a headless server program
implemented as a .NET C# Console project. There is a UPS mounted to
this server (though not a windows compliant UPS). I can only talk to
the UPS over a special device driver.
Through this device driver I can detect that the UPS is going to notify
Windows 2000 server to shut down. So I start doing a graceful
termination. But Windows shuts down pretty quickly and there isn't time
to close my files and gracefully shut down. Apparently, the default
console application in .NET has a default behavior of terminating
immediately -- at least that is what seems to happen.
What I need to do is to delay windows for long enough (just a few
seconds really) so that I can gracefully terminate. How do I do that
with a console project? How do I delay the time between the time that
Windows 200 Server is told to shut down and the time it actually
teminates it's applications and shuts down? I've done a lot of web
searches and .NET searches but haven't found a console solution. Maybe
all I need is a steer to the right approach.
Thanks.
David W. Griffin
Lockheed Martin Aeronautics Company
|
|
|
|
|
I got a reply on microsoft.public.dotnet.languages.csharp on this that fixed my problem. I'll reprint it here with his permission in case someone searches here and would like to know how this was resolved:
Willy Denoyette [MVP] Oct 5, 12:23 pm
You can register your own Console control handler by calling Win32 API
SetConsoleCtrlHandler.
Conside following snippet as a sample.
enum CtrlType {
CTRL_C_EVENT = 0,
CTRL_BREAK_EVENT = 1,
CTRL_CLOSE_EVENT = 2,
CTRL_LOGOFF_EVENT = 5,
CTRL_SHUTDOWN_EVENT = 6
}
static object locker = new object();
private delegate bool EventHandler(CtrlType sig);
private static bool Handler(CtrlType sig)
{
bool handled = false;
switch (sig)
{
case CtrlType.CTRL_C_EVENT:
case CtrlType.CTRL_LOGOFF_EVENT:
case CtrlType.CTRL_SHUTDOWN_EVENT:
case CtrlType.CTRL_CLOSE_EVENT:
{
.. do whatever you need to do at shutdown time (here for all
other events too), but keep in mind that the system will kill the process
when you fail to return within 30 seconds.
}
// return true when handled, this signals the system to remove
the process
handled = true;
break;
default:
// return false when not handled
return handled;
}
return handled;
}
static EventHandler _handler;
[DllImport("Kernel32")]
private static extern bool SetConsoleCtrlHandler (EventHandler handler,
bool add);
static void Main()
{
// install the handler
_handler += new EventHandler(Handler);
SetConsoleCtrlHandler(_handler, true);
// and go on
...
Willy.
David W. Griffin
Lockheed Martin Aeronautics Company
|
|
|
|
|
I've been trying to find a solution to this problem. Searching here, Business Objects and several other sites, I'm finding many requests outlining the same problem but in none have I found an answer to it.
Given the programatic declaration of a Crystal Report as defined below, it works great in all reports except when I need to use a variable that has to accept multiple values such as prmStatusCodes. With this parameter, the user identifies with check boxes the status' of orders they wish to view.
rptCustomerSummary newRpt = new rptCustomerSummary();
CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
rptDocument.Load(ReportsPath+"rptCustomerSummary.rpt");
crViewer.ShowGotoPageButton = true;
crViewer.ShowPageNavigateButtons = true;
CrystalDecisions.Shared.TableLogOnInfo rptLogin = new CrystalDecisions.Shared.TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in newRpt.Database.Tables)
{
rptLogin = tbl.LogOnInfo;
rptLogin.ConnectionInfo.ServerName = dbServer;
rptLogin.ConnectionInfo.UserID = dbReportLoginName;
rptLogin.ConnectionInfo.Password = dbReportLoginPwd;
tbl.ApplyLogOnInfo(rptLogin);
}
currParamValue = new ParameterValues();
paramValue = new ParameterDiscreteValue();
paramValue.Value = CompanyId.ToString();
currParamValue.Add(paramValue);
paramFieldDefs = newRpt.DataDefinition.ParameterFields;
paramFieldDef = paramFieldDefs["prmCustomerId"];
paramFieldDef.ApplyCurrentValues(currParamValue);
currParamValue = new ParameterValues();
paramValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
foreach (int i in ReportOptionIntAry)
{
paramValue.Value = ReportOptionIntAry[i].ToString();
currParamValue.Add(paramValue);
}
paramFieldDefs = newRpt.DataDefinition.ParameterFields;
paramFieldDef = paramFieldDefs["prmStatusCodes"];
paramFieldDef.ApplyCurrentValues(currParamValue);
crViewer.ReportSource = newRpt;
In Crystal Reports, I've defined the parameter prmStatusCodes as a Discrete of type Number and Allow Multiple Values. In the report Select Expert I have
RPT_CUSTOMER_SUMMARY_V.CUSTOMER_ID} = {?prmCustomerId} and
{RPT_CUSTOMER_SUMMARY_V.STATUS_ID} in {?prmStatusCodes}
In the report, if I change {?prmStatusCodes} to [5, 7, 9, 24] as if the user selected those four statuses, it gives the expected results. If I use the parameter and pass in a set of statuses, only those orders that are the status of the first parameter display. It does matter what parameters are passed in, only the first parameter is recognized.
Can someone point out the error of ways?
|
|
|
|
|
I want to populate bool array with all true value
in java there is a method called Arrays.Fill to populate all the elements in an array in one go
Is there anything similar in C# ?
jills
|
|
|
|
|
|
Hey Stefan,
I want to populate the boolean array with all "true" value!
using this Array.Initialize i can initialize them to false value ..
which is by default while u instantiate the bool array !!!
jills
|
|
|
|
|
Hi,
i wasn't sure what is the default value value of a boolean. Unfortunately it is the wrong one for your needs
In this case you won't get around using a for loop to initialize the array:
bool[] array = new bool[5];
for (int index = 0; index < array.Length; index++)
array[index] = true;
www.troschuetz.de
|
|
|
|
|
Hallo,
I want to build a server and a client application.
The server should be some kind of intelligent. He is able to process information from one format to another.
The client should be thumb. On the client machine is an Excel application which could be started by the client.
The situation is that the client starts the Excel application and remembers a pointer to it. This pointer should be send to the server. The server should use the pointer to execute commands directly on the Excel application on the client machine. For example to open an Excel workbook that lies on the client machine and to read information from a worksheet of this workbook.
How can I realize the communication between the server and the client? Can I use Remoting or should I use some kind of socket communication? Is there a tutorial which I can use as a reference?
Thanks allot
Andre Pietsch
PS: sorry if there are mistakes in my english
|
|
|
|
|
I have the following code to rotate an image:
Image img=new Bitmap(400,400);
//assigned to pictureBox 4
pictureBox4.Image=img;
Graphics g=Graphics.FromImage(pictureBox4.Image);
//Create a new matrix
Matrix mm=new Matrix();
mm=new Matrix(1,0,0,-1,0,0);
mm.Translate(25,104,MatrixOrder.Append);
g.Transform=mm;
Matrix mm1=new Matrix();
mm1.RotateAt(
trackBar1.Value,
new Point(67,2),
MatrixOrder.Append);
GraphicsPath gp=new GraphicsPath();
Image imgpic=(Image)Rotor_pictureBox.Image;
gp.AddPolygon(new Point[]{new Point(0,Rotor_pictureBox.Height),new Point(Rotor_pictureBox.Width,Rotor_pictureBox.Height),new Point(0,0)});
gp.Transform(mm1);
//get the resulting path points
PointF[] pts=gp.PathPoints;
//draw on the picturebox content of imgpic using the local transformation
//using the resulting parralleogram described by pts
g.DrawImage(imgpic,pts);
pictureBox4.Refresh();
This code works great. However, I can't get the image to BrintToFront. I need it to rest on top of another picturebox. If there is another picture box within the rotating image's area, it covers it up. I tried to put an image WITHIN the picturebox that the rotating image is being drawn on, but it doesn't show up. Any help would be much appreciated. Thanks.
D
-- modified at 7:41 Wednesday 5th October, 2005
|
|
|
|