 |
|
 |
But could you translate to ferengi for a tricorder in X#?
If someone wants this in another language why do they ask you to convert it for them?
|
|
|
|
 |
|
 |
Fantastic Controls.
I have just had the misfortune of having to switch from VB6 to VB.Net, the Marbry controls i use are .Com activeX and wont load to .Net.
Could you please advise how i might load and use these controls with VB.net
Many Thanks Jason
|
|
|
|
 |
|
 |
Great job.
I'd like to do something like this that includes GPS data displayed. Comm radio frequency displays, etc.
I have an arduino with GPS shield that works.
Why did you use C# instead of C/C++? I don't know anything about C#.
|
|
|
|
 |
|
 |
Hello,
I was looking for information about using C# for interfacing MS Flight Simulator X with an external hardware add-on, self-designed and built, through an USB link. I have the FS X Software Development Kit, and C# express 2010, along with Visual Studio 2010, and .NET framework v4.0. Till today, all I could find in the MS help files (there are many !) could not help me.
The help files of the FS X SDK are written for C/C++ users. There are some notes about C# users, but it may be that they have been written for a previous version. So even when I copy-paste the so called working samples into my code, I have errors and I cannot go further. I tried to modify the code, I made some progress, but not much.
I digged the web in depth, and all I could find are programms written in other languages, or in other versions of C#. Or source codes that are partially shown. So I am stopped.
And today, I found your post. Great ! Congratulations !
Maybe I can make a step ahead. Do you think you can help me in this matter (that is SDK of FS X and C#) ?
Note : I am totally new in C#, but not new at all in software writing. I stopped years ago with VB3. I am fluent in assemblers and Basic for microcontrollers. But I am totally confused with these modern languages, where I cannot make the difference between keywords, instructions, variables, structures and other new words. All the same, I can build a form, put some controls in, and make something running. I don't say that I understand all I write, but it runs. I am a retired engineer, age 65.
Thanks.
Jean-Paul
|
|
|
|
 |
|
 |
very nice work
i love you
|
|
|
|
 |
|
 |
Excellent!, these avionics instruments are cool.
|
|
|
|
 |
|
 |
Thanks for this, it is the perfect compliment to the .Net control I am working on for the AR Drone.
Steve Hobley
www.stephenhobley.com
|
|
|
|
 |
|
 |
I hope this will be available on Windows Mobile..
Software Developer
Jayzon Ragasa
Baguio City, Philippines
|
|
|
|
 |
|
 |
Thank you for sharing your project
Can you explain how you created the bmp files? I was looking for similar background pictures...
Serhat
|
|
|
|
 |
|
 |
Hi All,
Thanks Guillaume for some great software. I have modified DemoWinow() to use a WinSock TCP/IP connection to direct network output of instrument data from the Flight Gear simulator. It works very well.
I have removed the user controls, added a few additional dials (e.g. for engine) and am in the process of mounting the display in a physical aircraft mockup that will include 2 degrees of freedom motion, with motors driven via x,y,z acceleration outputs from Flightgear.
Guillaume, if you read this, would it be ok to photo and publish the 'new' software?
I can be emailed thrugh this site.
Many thanks.
|
|
|
|
 |
|
 |
This is very good Gauges for Windows form. Can you please tell me how to use these controls in C#,ASP.NET
Regards
Girish
|
|
|
|
 |
|
 |
How would you add the controls to another project? I keep getting failed to create component error
|
|
|
|
 |
|
 |
Yes, i also need to know how to use these commands in another project. I just added the files of the controls and resources directories and tried to add a new reference but i didn't find any .dll. I have now the controls in my Tool Panel but when i drag one to the main Form, I have an error like System.Resources.MissingManifestResourceException and it is impossible for me to find the solution. Please, could you share how to do it?. Thank you very much.
Alejos
|
|
|
|
 |
|
 |
Hi,
I am not sure about your error but I followed the steps in "DLL (Class Library)" section of the "CSharp Tutorial":
http://www.dcs.gla.ac.uk/~barry/hci4/Slides/csharp_tutorial.pdf[^]
and I can reach the controls in my project.
Key point is that you should do "Add | New Item | User Control" for every control and call these "new user controls" from your project.
P.S. I use Visual Studio 2008...
Serhat
|
|
|
|
 |
|
 |
When you do this do you have them deriving from user control? or do you keep it like the original file deriving from Control?
|
|
|
|
 |
|
 |
I found the easiest solution for me was to forget trying to add it to the tool box via a dll (didnt like this becuase the controls were derived from control and not user control), and just manually add and position my items. Just make sure to rename the images namespace extensions in each of the instrument control files to work with your project.
|
|
|
|
 |
|
 |
Nice looking controls.
Just a remark : i think the Graphics class can do the exact rotation by using TranslateTransform to change the rotation center.
|
|
|
|
 |
|
 |
Excellent controls Chootair.
NicolasG, since transformation matrices can be combined together I also think it would work if we translate the rotation point to origin, rotate and then translate back. e.g. the following would work in case of Attitude control where the rotation is about the mid point say 150,150:
GraphicsState oldState = graphics.Save(); // save existing matrices
// make rotation point the origin
graphics.TranslateTransform(-150, -150);
// rotate
graphics.RotateTransform((float)(alphaRot * 180 / Math.PI), MatrixOrder.Append);
// translate back
graphics.TranslateTransform(150, 150, MatrixOrder.Append);
// code to draw image comes here
....
....
graphics.Restore(oldState); // restore old
In any case, the controls work great as is.
|
|
|
|
 |
|
|
 |
|
 |
Nice job!
A few things;
Plural of foot is feet, not "feet's" (trivial I know, but I hold an ATPL so the more realistic it is the better
An altimeter has a window to set the ambient pressure with the standard ISA atmosphere being 1013 hPa or 29.92 millibars (US).
Would be really cool to custom draw atleast the ASI, so you can set various V speeds, also building a Pitot Static interface so you can demonstrate what would happen if your Pitot or Static sources are blocked during an climb or decent.
Heading bugs and V speed bugs would also be awesome.
Drawing Flight Director bars and/or LOC/GS bars to show what an analog display looks like would be cool too.
Al
|
|
|
|
 |
|
 |
Hi,
Nice job but you left one thing out...
I am a pilot and I fly fixed and rotary wing, and lots of different aircraft....
You left out "shudder" !!!!
All flight instruments I have seen have "shudder" where the needle is never pegged but vibrates around a value... adding shudder would give your controls a sense of realism....
Bill
The Infomercial King(tm)
|
|
|
|
 |
|
 |
Have you tried A/C with "Glass Cockpits" display systems? I wounder if a A380 pilot would want "shudder" on is display, but I am not a pilot...
|
|
|
|
 |
|
 |
Hi,
I am a pilot and not an engineer but I think the "shudder" in the prop planes and jets I have flown is due to the vibration... even a gentle vibration in a Lear or Falcon or Tri-Star jet will cause the needle to of non-digital displays to shudder.
I guess I should have also mention that you don't have shudder with all digital displays but with real needles they vibrate.
Great controls!
Bill
The Infomercial King(tm)
|
|
|
|
 |
|
 |
I changed the Horizon Bitmap so you can display a full +/-90 degree pitch angle, i.e. a loop. I had to stretch the image to include 90 degree and past that point to 60 and -60 degrees in both directions. Then I had to modify the OnPaint method as below
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
Point ptBoule = new Point(25, - 330);
Point ptRotation = new Point(150, 150);
float scale = (float)this.Width / bmpCadran.Width;
bmpCadran.MakeTransparent(Color.Yellow);
bmpAvion.MakeTransparent(Color.Yellow);
RotateAndTranslate(pe, bmpBoule, RollAngle, 0, ptBoule, (int)(4*PitchAngle), ptRotation, scale);
Pen maskPen = new Pen(this.BackColor,30*scale);
pe.Graphics.DrawRectangle(maskPen, 0, 0, bmpCadran.Width * scale, bmpCadran.Height * scale);
pe.Graphics.DrawImage(bmpCadran, 0, 0, (float)(bmpCadran.Width * scale), (float)(bmpCadran.Height * scale));
pe.Graphics.DrawImage(bmpAvion, (float)((0.5 * bmpCadran.Width - 0.5 * bmpAvion.Width) * scale), (float)((0.5 * bmpCadran.Height - 0.5 * bmpAvion.Height) * scale), (float)(bmpAvion.Width * scale), (float)(bmpAvion.Height * scale));
}
It would also be nice if the altitude digits scrolled more smoothly, instead of just on step based on the previous decade digit. e.g It should scroll for values around 10 feet before the digit must change.
This is what I did for the altimeter I did a while bac, which is fairly similar. I also use a background image to do the drawing before painting it to the current canvas. It helps with
private void Altimeter_Paint(object sender, PaintEventArgs e)
{
try
{
SolidBrush NeedleBrush = new SolidBrush(Color.Yellow);
// Draw the background Image
this.BackgroundImage = new Bitmap(this.Width, this.Height);
Graphics Background = Graphics.FromImage(this.BackgroundImage);
// Draw the dial
Background.DrawImage(this.DialImage, 0, 0);
// Draw the scrolling numbers
float imageIndex;
// First the 10s numbers
imageIndex = this.mAltitude % 100;
imageIndex = imageIndex / 10;
float lowDigit = imageIndex;
imageIndex = (imageIndex * this.DigitHeight_10) + this.DigitStart_10;
Background.DrawImage(this.TensImage, this.DigitRect_10, new Rectangle(0, (int)imageIndex, this.TensImage.Width, this.DigitRect_10.Height), GraphicsUnit.Pixel);
// Then the 100s
imageIndex = this.mAltitude / 100;
imageIndex = imageIndex % 10;
imageIndex = (float)Math.Floor(imageIndex);
imageIndex = (imageIndex * this.DigitHeight_10) + this.DigitStart_100;
// Slowly shift this digit when it reaches 90 feet
if (lowDigit > 9)
{
float shift = (lowDigit - 9) * this.DigitHeight_10;
imageIndex += shift;
}
// Draw the digit
Background.DrawImage(this.HundredsImage, this.DigitRect_100, new Rectangle(0, (int)imageIndex, this.HundredsImage.Width, this.DigitRect_100.Height), GraphicsUnit.Pixel);
// Then the 1000s
if (this.mAltitude < 990)
{
Background.DrawImage(this.FlagImage, this.DigitRect_1000, new Rectangle(0, 0, this.FlagImage.Width, this.FlagImage.Height), GraphicsUnit.Pixel);
}
else
{
imageIndex = this.mAltitude / 1000;
imageIndex = imageIndex % 10;
// Check to see this digit is moving
bool updateDigit = false;
if ((imageIndex % 1) > 0.99)
{
updateDigit = true;
}
imageIndex = (float)Math.Floor(imageIndex);
imageIndex = (imageIndex * this.DigitHeight_1000) + this.DigitStart_1000;
// Slowly shift this digit when it reaches 90 feet
if ((lowDigit > 9) && updateDigit)
{
float shift = (lowDigit - 9) * this.DigitHeight_1000;
imageIndex += shift;
}
Background.DrawImage(this.ThousandsImage, this.DigitRect_1000, new Rectangle(0, (int)imageIndex, this.ThousandsImage.Width, this.DigitRect_1000.Height), GraphicsUnit.Pixel);
}
// Finally the 10,000s, if there is no 10,000s, then display the number as flagged
if (this.mAltitude < 9990)
{
Background.DrawImage(this.FlagImage, this.DigitRect_10000, new Rectangle(0, 0, this.FlagImage.Width, this.FlagImage.Height), GraphicsUnit.Pixel);
}
else
{
imageIndex = this.mAltitude / 10000;
// Check to see this digit is moving
bool updateDigit = false;
if ((imageIndex % 1) > 0.999)
{
updateDigit = true;
}
imageIndex = (float)Math.Floor(imageIndex);
imageIndex = (imageIndex * this.DigitHeight_1000) + this.DigitStart_1000;
// Slowly shift this digit when it reaches 90 feet
if ((lowDigit > 9) && updateDigit)
{
float shift = (lowDigit - 9) * this.DigitHeight_1000;
imageIndex += shift;
}
Background.DrawImage(this.ThousandsImage, this.DigitRect_10000, new Rectangle(0, (int)imageIndex, this.ThousandsImage.Width, this.DigitRect_10000.Height), GraphicsUnit.Pixel);
}
// Draw the pointer
float altNeedleAngle = (((this.mAltitude % 100) / 100.0F) * 360.0F) - 90.0F;
// Work out the needle endpoint
Point altPoint = new Point();
altPoint.X = this.dialCentre.X + (int)Math.Round(this.NeedleLength * Math.Cos(altNeedleAngle * Math.PI / 180));
altPoint.Y = this.dialCentre.Y + (int)Math.Round(this.NeedleLength * Math.Sin(altNeedleAngle * Math.PI / 180));
Point TipPoint1 = new Point();
TipPoint1.X = this.dialCentre.X + (int)Math.Round((this.NeedleLength - 8) * Math.Cos((altNeedleAngle - 5) * Math.PI / 180));
TipPoint1.Y = this.dialCentre.Y + (int)Math.Round((this.NeedleLength - 8) * Math.Sin((altNeedleAngle - 5) * Math.PI / 180));
Point TipPoint2 = new Point();
TipPoint2.X = this.dialCentre.X + (int)Math.Round((this.NeedleLength - 8) * Math.Cos((altNeedleAngle + 5) * Math.PI / 180));
TipPoint2.Y = this.dialCentre.Y + (int)Math.Round((this.NeedleLength - 8) * Math.Sin((altNeedleAngle + 5) * Math.PI / 180));
Point TipPoint3 = new Point();
TipPoint3.X = this.dialCentre.X + (int)Math.Round(this.NeedleStart * Math.Cos(altNeedleAngle * Math.PI / 180));
TipPoint3.Y = this.dialCentre.Y + (int)Math.Round(this.NeedleStart * Math.Sin(altNeedleAngle * Math.PI / 180));
// Create the polygon with the points
Point[] altNeedle = {
altPoint, // The end of the needle
TipPoint1, // The left side pint
TipPoint3, // The inner tip point
TipPoint2 }; // The right side other side
// Draw the polygon
Background.FillPolygon(NeedleBrush, altNeedle);
// Paste the image to the control
e.Graphics.DrawImage(this.BackgroundImage, 0, 0);
// Freeup the resources
NeedleBrush.Dispose();
this.BackgroundImage.Dispose();
Background.Dispose();
}
catch (Exception ex)
{
if (ex.Message != "")
{ }
}
}
|
|
|
|
 |
|
 |
Thank you for your improvements on the code, it is cool.
About the altimeter scrolling it is true that is not as smooth as on real instrument. I tried several solution and I finally chose to just offset the draw of the "9". In fact my main constraint was that the number of digits could be defined as a function parameter so I do not difference the unit digit, the ten digit, the hundred digit ect... there are draw equals.
But I'll try to improve that, inspired by your solution.
Merci,
A plus.
|
|
|
|
 |