|
Is it possible to set the default button on a user control in the same way you would set myForm.AcceptButton = button for a Form.
|
|
|
|
|
Hello everyone,
I wanted to make a simple moonphase application for my Windows based smartphone, showing the current moonphase, and possibly other information too (moon calendar, moonrise and set times, etc). However, I can't find any C# code or library for these calculations (just some python and Java).
Does anyone know about anything (a .NET library or C# code?)
I'd be very grateful!
Thanks,
Rado
Radoslav Bielik
www.neomyz.com/poll [^] - Get your own web poll
www.neomyz.com/rss [^] - RSS Web Reader - latest news for your site
www.neomyz.com/games [^] - Add a small game to your website
|
|
|
|
|
Unless you can find an oss app to steal from you're going to have to do this yourself. The actual formulas should be findable without too much effort, but this is too obsure a role to have a dedicated public library available.
|
|
|
|
|
|
Thanks Ravi, I'll try that. Actually, I've already seen Siamak's website, and was thinking that maybe I could write him if I don't find anything else, so it seems that will be the way to go.
I also found a nice Java mobile application - which does much more than the moon phase calculation - it's a compass for navigating by sun/moon position on the sky. I've been thinking that I may try to port that into C# and create a smartphone version, just for fun. It works on a smartphone too, but still could be improved. But I'm not sure I have enough time for that.
Rado
Radoslav Bielik
www.neomyz.com/poll [^] - Get your own web poll
www.neomyz.com/rss [^] - RSS Web Reader - latest news for your site
www.neomyz.com/games [^] - Add a small game to your website
|
|
|
|
|
I have seen a program which could change the function of the keyboard.For example when you press letter A on the keyboard it will print B to the screen.Can i write a program like that using C#?Thanks for reading
|
|
|
|
|
Dear Friends,
I have a class with two Member variables inside it as follow :
<code>
public class MyView
{
private string name;
public string Name
{
get{return this.name;}
set{this.name = value;}
}
private DataView dv;
public MyView(string vName)
{
this.dv = new DataView();
this.name = vName;
}
}
</code>
I dont want to set the internal DataView variable to public and I want to use Binding when using this class as follow.Suppose that the BindGridView method is a method in a windows form class :
private void BindGridView()
{
MyView viewOnject = new MyView("SampleView");
this.dataGridView1.DataSource = viewObject;
}
How can I do this ?
Note : I dont want to set the internal DataView variable to public or expose it as a public property.
Best Regards,
Xironix
[ _ Always there is another way _ ]
-- modified at 12:20 Friday 16th June, 2006
|
|
|
|
|
Hello all,
I created a Setup which will installs an assemblie in GAC. my setup is instaling assemble in GAC. it is fine.
problem is assembly physical location is C:\Program Fles\ABC\MyDLLProject
here DbConnection.txt file is also copying alng with installation. but my Shared assembly needs connection string. i.e exists at above location and DLL is at C:\Windows\Assembly.
Where i will copy DbConnection.txt file?
|
|
|
|
|
I don't want solutions, just a quick yes, but... or ha ha, you've gotta be kidding...
From an ASP.NET C# codebehind page, I want to shell out to an executable (legacy C++), capture the output (it writes to std::out), and then render it (the easy bit).
What are my chances? If this is possible, I will do more investigation, if I have no chance, then I will rethink the solution.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
You might be able to use code like this, where 'proc' is a System.Diagnostics.Process object:
proc.StartInfo.RedirectStandardOutput = true;
proc.StandardOutput = xyz;
HTH,
josh
|
|
|
|
|
I've had problems with this, there are some wierd behavious that can happen with the wrong combination of properties. The following example will show a command window on the machine it's executing on. I don't know what will happen if you run this from a web app though. Good luck.
private string ExecuteShell(string commandText) {
System.Diagnostics.Process proc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd", commandText);
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
proc.StartInfo = psi;
proc.Start();
System.IO.StreamReader stdout = proc.StandardOutput;
string output = stdout.ReadToEnd();
proc.Close();
return output;
}
Visit BoneSoft.com
|
|
|
|
|
Hi,
I'm trying to use the paint method to draw a table on a panel in a windows form. For some reason, the paint method is being called over and over again (I don't even know how many times!) when the form is opened. Does anybody know why this is happening? I'm fairly new to all this, so any insight is much appreciated.
Thanks!
RC
|
|
|
|
|
Common events like Paint and MouseMove fire very frequently. That's the nature of the beast.
Cheers,
josh
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Sorry!
I wasn't sure where to put that one...
RC
|
|
|
|
|
i've added a table into a datagridview, from sqlserver. the birthday column of the table needs the DateTime typed data, so when i write a String character in a cell of that column, an error occurs. by means of which event i can catch this error?
|
|
|
|
|
Hey Guys,
I have a c# application that uses win32 code to take a screencapture of a window running on the system. It then compares a portion of that screencapture with a bitmap that I have already pre-captured to see if that window is in a certain state.
When I first wrote the code it compared no problem, but now when I use it the two images are not EXACTLY the same. My application captured the right part of the graphic, but when I compared both images (by zooming in in photoshop) they are not the same. Looks like the screencapture was worse quality.
I saved the image I compare to as a Windows Bitmap 24 bit and the image I capture I am not sure what quality it is. Although my screen resolution is 32 bit.
Is there someway that I can make sure that the image I capture and the image I compare to are the same bit depth and quality using c#?
Here is some code I have
public static Bitmap GetWindowCaptureAsBitmap(int handle)<br />
{<br />
#region GetWindowCaptureAsBitmap<br />
IntPtr hWnd = new IntPtr(handle);<br />
Win32.Rect rc = new Win32.Rect();<br />
if (!Win32.GetWindowRect(hWnd, ref rc))<br />
return null;<br />
<br />
<br />
IntPtr hdcWindow = Win32.GetWindowDC(hWnd);<br />
<br />
Win32.BitBlt(hdcBitmap, 0, 0, rc.Width, rc.Height,<br />
hdcWindow, 0, 0, (int)Win32.TernaryRasterOperations.SRCCOPY);<br />
<br />
gfxBitmap.ReleaseHdc(hdcBitmap);<br />
<br />
<br />
Win32.ReleaseDC(hWnd, hdcWindow);<br />
<br />
gfxBitmap.Dispose();<br />
<br />
return bitmap;<br />
#endregion<br />
}<br />
private bool IsPlayersTurn(Image imgScreen)<br />
{<br />
#region IsPlayersTurn<br />
bool bRetVal = false;<br />
<br />
Image imgIsPlayerTurn = EmbeddedResources.LoadImage(EmbeddedResources.PartyIsPlayersTurn);<br />
Bitmap IsPlayerTurn = GetImage(imgScreen, 188, 463, 455, 11);<br />
Bitmap oCompare = new Bitmap(imgIsPlayerTurn);<br />
<br />
<br />
if (Imagio.ComparingImages.Compare(IsPlayerTurn, oCompare) == Imagio.ComparingImages.CompareResult.ciCompareOk)<br />
{<br />
bRetVal = true;<br />
Debug.WriteLine("Match OK");
}<br />
<br />
return bRetVal;<br />
#endregion<br />
}
Thanks,
Greg
-- modified at 10:20 Friday 16th June, 2006
|
|
|
|
|
I am trying to read text from a file, however, I keep getting "The process cannot access the file ... because it is being used by another process."
The issue is, I know that another process has the file open, but I need to be able to read the file without closing that process.
The weird thing is, I can open and edit the text file with notepad, but all the methods I have tried thus far in C# keep throwing the access error.
Here is one of the ways I am trying to open the file:
<br />
<br />
FileStream file;<br />
TextReader reader;<br />
<br />
try<br />
{<br />
file = new FileStream("C:\\file.log", FileMode.Open, FileAccess.Read, FileShare.Read);<br />
reader = new StreamReader(file);<br />
<br />
string test = reader.ReadLine();<br />
<br />
MessageBox.Show(test);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString());<br />
}<br />
<br />
-- modified at 11:55 Friday 16th June, 2006
|
|
|
|
|
after reading a line
put reader.Close();
and then try
|
|
|
|
|
It doesn't even make it that far. The error is thrown when I try opening the stream.
|
|
|
|
|
This code seems me ok, I think there could be some issues related to file/system security.
Riz
|
|
|
|
|
You're only reading one line, is this code in a loop? Can't help much without seeing the context in which that code executes.
Of course there is the possibility that another process is using the file. It's a log file, is there something that's logging to it?
Try something like...
try {
string text = string.Empty;
using (StreamReader reader = new StreamReader(@"C:\file.log")) {
text = reader.ReadToEnd();
reader.Close();
}
} catch {}
Visit BoneSoft.com
|
|
|
|
|
Hi,
I have some ini files with me. I want to create a wizard that would take this ini file as its input and output a C# class which when given to a control would give me means to edit the ini file. I'm speaking in the context of .Net. Ultimately i'm trying to create a tool that would make edition of the ini files possible. There is a wiward creation toll in .Net that is available. Please let me know of some good pointers to the same.
Thanks
Ashutosh
|
|
|
|
|
Hi. I'm writing Free Commander, and I have problem how to show files and folders in listView (like in Total Commander). My Second problem is that how to show local drives in combo box. I will be very greateful for any info.
|
|
|
|
|