|
Don't.
It may seem to fit the bill for you homework question, but blindly converting code from one language to another does not normally produce code that is any good in the destination language. Pascal is not C#, and does not use the same underlying framework. If you must, understand how it's doing whatever it is doing, and adapt the algorithms to C# in a new application. But don't try and get it translated and assume you will get a good grade: you won't. And that's ignoring that your tutor is aware this site exists and will almost certainly spot the plagiarism...
Besides: that code is very, very poor - it looks like it was written by three chimpanzees who never actually spoke to each other ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
And, as everyone knows, Pascal code must be in all caps.
|
|
|
|
|
OriginalGriff wrote: written by three chimpanzees
Chimpanzees write better code than that... Maybe it was actually written by a cat walking across the keyboard?
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
modified 13-Dec-16 15:33pm.
|
|
|
|
|
NotPolitcallyCorrect wrote: Chimpanzees write better code than that...
They certainly do! Primate Programming(tm) Inc[^]
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
|
|
I draw a radar screen with C#. In radar screen, planes(PictureBox) can move from start point to end Point. Scanning Line can also run. Although, I cannot code tracking line behind the planes for my poor knowledge. May you help me?
<pre lang="c#"> private void timer1_Tick(object sender, EventArgs e)
{
if (i > 361)
{
i = 0;
rotate = true;
}
else
{
i += 1;
angle = i;
foreach (Control con in this.picRadarRing.Controls)
{
if (con is PictureBox)
{
PictureBox pb = con as PictureBox;
if (angle > s)
{
rotate = true;
}
degg = 90 - (int)Angle(pb.Location, new Point((picRadarRing.Width / 2), (picRadarRing.Height / 2)));
startX = pb.Location.X;
startY = pb.Location.Y;
double dis = Math.Sqrt(Math.Pow(endX - startX, 2) + Math.Pow(endY - startY, 2));
double directionX = (endX - startX) / dis;
double directionY = (endY - startY) / dis;
if (degg == 0)
{
degg = 1;
}
if (degg < 0)
{
degg += 360;
}
if (angle == degg)
{
if (rotate)
{
x1 = pb.Location.X;
y1 = pb.Location.Y;
x1 += directionX * speed * elapsed;
y1 += directionY * speed * elapsed;
pb.Location = new Point((int)x1, (int)y1);
}
rotate = false;
s = (90 - (int)Angle(pb.Location, new Point((picRadarRing.Width / 2), (picRadarRing.Height / 2))));
if (s < 0)
{
s += 360;
}
}
}
private void picRadarRing_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.ResetTransform();
g.TranslateTransform(picRadarRing.Width / 2, picRadarRing.Height / 2);
g.RotateTransform(angle);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawImage(hand, 0.00f, 0.00f, 5, (picRadarRing.Width / 2) - 4);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
private void btnAdd_Click(object sender, EventArgs e)
{
if ((txtSy.Text == "") || (txtSx.Text == "") || (txtEndY.Text == "") || (txtEndX.Text == ""))
{
MessageBox.Show("Enter Point");
}
else
{
count += 1;
endX = Convert.ToDouble(txtEndX.Text);
endY = Convert.ToDouble(txtEndY.Text);
Tx = Convert.ToInt32(txtSx.Text);
Ty = Convert.ToInt32(txtSy.Text);
Airplane(Tx, Ty);
timer1.Start();
}
}
private double Angle(Point start, Point end)
{
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
}
private void Airplane(int TX, int TY) // to Create air thread picturebox
{
PictureBox pic = new PictureBox();
foreach (Control con in this.picRadarRing.Controls)
{
if (con is PictureBox)
{
if (con.Name == "airplane")
{
this.picRadarRing.Controls.Remove(con);
}
}
}
this.picRadarRing.Controls.Add(pic);
pic.BackColor = Color.Red;
pic.Location = new Point(TX, TY);
pic.Size = new Size(7, 7);
pic.Name = "airplane-" + count;
}
modified 13-Dec-16 14:23pm.
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So show us what you do to make the planes move, and what you have tried to draw the "scanning lines" - we can't really help from little or no information!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You're going about this all wrong.
Specifically, you're liberal use of PictureBoxes. The PB control is just a quick'n'dirty control to show an image. It is not designed to handle layering and animation and is just going to complicate things for you, immensly.
What you should do is get rid of all the PictureBox controls and handle all the drawing yourself on the surface of a control, like a Panel. You get the greatest amount of control this way. This is kind of what you're doing in the Paint event of whatever control that is.
Also, SetStyle calls should never show up in a Paint handler or any other drawing code. That's a one-time use call that should show up only in the constructor of a custom control or form.
|
|
|
|
|
To elaborate on Dave Kreskowiak's post.
- You need a panel (you can change the background color if you like)
- Learn GDI+ if working with winforms. Basically it involves putting the handle of the panel into a Graphics object and from there you get access to drawing tools like lines, ellipses, rectangles, ...
- If you do have the Graphics object you need code in place to redraw everything, else all the updates will draw over the previous situation.
This should get you started.
|
|
|
|
|
|
hello pple, my name is patrick, a university student persuing a bsc in computer science. am thinking of coming up with a software that uses fingerprint to carry pout transactions, i need help on how to do it kindly
|
|
|
|
|
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hello Patrick. That was nice an polite of you (I'm Pete by the way).
As you may have gathered from the response from OriginalGriff, you need to supply a lot more detail when you are asking a question. When you repost your question, make sure to tell us what code you have, what isn't working and what you have tried. That way, we will know what to focus our attention on.
This space for rent
|
|
|
|
|
|
How to do what, exactly? What part of this are you having a problem with?
So far, you have provided a vague title for a project, but have not defined, in precise terms, what this app is supposed to do, and the scope of the application. That's your first step.
Transactions? What transactions? Database transactions? Monetary transactions? Transactions between what and what? Or Who and what? Or Who and Who?
How are these parties going to enroll in your system? What authentication methods are going to be used, if any depending on scope? How are you acquiring credentials to identify the parties involved? Do you need a fingerprint verification on both sides of the transaction?
... The list goes on. If you don't define the problem you're trying to solve, you not going to solve the problem at all.
|
|
|
|
|
I tend to reject outright anyone that communicates at a kindergarten-level ... maybe you want to consider working on that before you "graduate".
|
|
|
|
|
Your question is so vague, it can cover about anything even remotely related to fingerprint.
Please refine the question.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Hi Team,
How can i call function from Forms through any of the controls?
Suppose i have function Validate() in FrmTest.cs under Global\Forms\
FrmTest.cs
private void Validate()
{
}
And control TestControl.cs under Global\Control\
TestControl.cs
For any drop down event changed,i need to invoke the function Validate() from FrmTest.cs.
Any suggestions will be great helpful
Thanks in advance
Manju
|
|
|
|
|
You need a reference to the class that contains the Validate method. But without some more details of your application it is difficult to be more specific.
|
|
|
|
|
You're doing this backwards. The control shouldn't know anything about the form it's on. It might not even be in the Controls collection of a Form. It may be a few levels deep in other control containers.
The control should validate it's own content, not the form.
|
|
|
|
|
Add a (public) "delegate" or Func<t1,...> instance to your target control that is automatically called by the event in question; the "default" response / behaviour of the delegate can be whatever you want (like a NotImplementedException).
Otherwise, you pass in a reference to "Validate()" and initialize the delegate with that reference when the target control(s) are created.
That's a generic way for attaching extra / new behavior to an object.
Depending on the development context (Windows Forms; WPF; MVVM; blah, blah), you would probably adopt some other technique (like "command binding"!).
|
|
|
|
|
how could i develop a wcf with multiple binding. say i would like to have one http binding and one tcp binding and now i want external user will use http binding and internal user will use tcp binding but if external use know tcp binding address then they will not be able to use it. this is the area i do not know how to handle. anyone give me some hint how to prevent external user to use my tcp binding ? thanks
tbhattacharjee
|
|
|
|
|
Allow the binding to be set up through config and don't allow access to the tcp binding through any external facing firewalls?
|
|
|
|
|
can we prevent tcp access by code? can we detect request is not coming from a specific domain ?
please guide. thanks
tbhattacharjee
|
|
|
|