|
private void button8_Click(object sender, System.EventArgs e)
{
<
|
|
|
|
|
HURRAY!!! THANKS SOOOO MUCH!! =DDD
|
|
|
|
|
I have 4 arraylists. One of which has an array of dates that I want to sort, but I need the other 3 arraylists to be sorted in the same order as the corresponding date order. What is the best way to do this? I don't have to use arraylists, but that is what I'm used to so that's what I'm using right now
|
|
|
|
|
The other arrays have other data that relates ? So ar1[0] and ar2[0] ( etc) all relate to one another ? Put your data in a struct, and set up a sorting function that sorts them based on date. If your data is connected, you should not disconnect it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes, they are all related to eachother. Could you give me an example of how to use a struct?
Thanks
JGA
|
|
|
|
|
|
Example:
public struct My4Datas: IComparable
{
public DateTime DateOfBirth;
public string FamilyName;
public string FirstName;
public bool Married;
public My4Dates(DateTime dateOfBirth, string familyName, string firstName, bool married)
{
this.DateOfBirth = dateOfBirth;
this.FamilyName = familyName;
this.FirstName = firstName;
this.Married = married;
}
public int CompareTo(object other)
{
return this.DateOfBirth.CompareTo(((My4Datas)other).DateOfBirth);
}
};
Somewhere others:
ArrayList myList = new ArrayList();
myList.Add(new My4Datas(...));
myList.Add(new My4Datas(...));
myList.Sort();
foreach (My4Datas data in myList)
{
string name = data.FirstName + " " + data.FamilyName;
}
Good Luck!
Niedzi
|
|
|
|
|
hi all,
In my program, I create a new winform from the main window form.
Then I minimize the newly created form while the program run.
How can I un-minimize the win-form in program(not maximize it) ?
And also, when I close the window form manually while it run,
and find that the winForm variable is still not null ? why ?
And how to completely disposed or null the window form in the program ?
Thank all
|
|
|
|
|
You can set it's initial state in the forms designer. Afterward, this.WindowState = FormWindowState.Normal;
It's not null because there's no reason for it to be. Set it to null yourself if you want to, it won't speed up disposal any more than it's going out of scope ( I wouldn't think ). But it's common to call a dialog and after it's been shown, request some data from it, so having it set itself to null would be counterproductive, as well as an unnecessary bit of magic.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Can I use c# to program the MSN to include it to be part of
my software to provide chatting function ?
Many thank !
|
|
|
|
|
|
I have a barcode scanner here, which can send bar codes as text, or work as a USB HID barcode scanner. I have no idea how to access the data in the second case, despite some heavy googling. Can anyone give me some pointers ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I have a question on how a thread return its control to the main program
thread(which run the GUI). The problem is that the main program thread
will generate thread to run other task and to a certain point, I want the generated task-running thread return task to the main program thread to continue running task. Is it possible and how to do that ?
Thank
|
|
|
|
|
Are you looking for the Join method on the System.Threading.Thread class?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for your reply.
What I want to do is as follow,
1. The main thread running the main window GUI as window form
which can accept user input all the time.
2. The second thread running some task,
and after the task is finished, the thread need to ask
main window form(controlled by the main thread) to display some
child window. But I find that the child window will not function
properly as two threads try to control the same GUI at the same time.
So I want to pass the control from the second thread to the main thread
and let the main thread open the child window itself.
Then how can I do that ?
|
|
|
|
|
You're looking for the Invoke/BeginInvoke methods on System.Windows.Forms.Control . Calling Invoke or BeginInvoke on the form, will call the delegate passed as a parameter on the main thread, which is exactly what you want. This[^] might help you understand it better.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks so much ! It is what i need exactly.
|
|
|
|
|
Hello all,
I want to create an application which inserts lines of text (of specified fonts) into a bitmap file, in certain locations.
I have searched the help for Font methods and bitmap methods, but came up with nothing. Any ideas anybody?
Thanks a lot,
Gal
|
|
|
|
|
A long time ago, I did a project in VB.NET (ASP.NET) that added text to some picture a person uploaded. This is probably what you need. This is the code in VB.NET
<br />
'adjust image<br />
Dim bmap As System.Drawing.Image<br />
bmap = System.Drawing.Image.FromFile("c:\test.bmp") 'you're file<br />
<br />
'add text<br />
Dim g As Graphics = Graphics.FromImage(bmap)<br />
Dim drawFont As New Font("Verdana", CSng(bmap.Width / 10), FontStyle.Regular, GraphicsUnit.Pixel)<br />
<br />
'create brush to draw text <br />
Dim drawBrush As New SolidBrush(Color.FromArgb(241, 238, 229))<br />
<br />
'position text at the bottom of the screen<br />
Dim xPos As Integer = CInt(bmap.Width / 37)<br />
Dim yPos As Integer = CInt(bmap.Height - ((bmap.Height / 6) * 2))<br />
'make rectangle for text<br />
Dim rect As New RectangleF(xPos, yPos, CSng(bmap.Width - 2 * xPos), CSng(((bmap.Height / 5) * 3)))<br />
'draw text<br />
g.DrawString("THE TEXT YOU WANT TO SHOW", drawFont, drawBrush, rect)<br />
<br />
<br />
It's not the most beautifull code, and it's in VB.NET, sorry for that. If you need the example in c# please let me know. The "save" part of the image is not included, but you just use the save method of the BitMap object. Don't forget to call the Dispose method of all the Bitmap and graphics object.
|
|
|
|
|
Great, I'll try it.
Thanks
|
|
|
|
|
gnjunge wrote:
Don't forget to call the Dispose method of all the Bitmap and graphics object.
And the Brush Object
|
|
|
|
|
May be somebody knows if such thing is exist. I mean, to compile project in c# into executable file like c++ does?
|
|
|
|
|
You do compile C# code into an executable, like C++. And just like C++ programs require the C Runtime Library, .NET-based applications like C# apps require the .NET framework runtime.
There are certain apps out there (google for .NET linker) that will link parts of the framework into your apps, thereby making your executable large (7 MB or so), but not requiring the framework.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
|
This happens even if I tell Visual Studio not to open a solution on startup.
If I do have it open the most recent solution, that solution completely
loads first. If I tell it to open and show the Open Solution dialog, it
does that. If it is supposed to open the Start Page, that opens.
Regardless, the startup action finishes and then it locks up.
Now technically, it might not have locked up. All I know is that the
hourglass cursor never disappears. So I go to the taskbar, and force
Windows to close the program. I see no warning other than what Windows
provides. That leads me to believe Visual Studio is unaware of what is
happening. Next time I start Visual Studio, it runs fine -- but only for
that session.
Does anyone have any ideas?
--------------
Will Pittenger
|
|
|
|