|
Hello everyone,
Here is my test program. I want to confirm that when we pass an out variable into a function, we just pass a reference, no additional copy is made?
class Program
{
struct Foo
{
public int abc;
}
static void Test(out Foo f)
{
f.abc = 200;
return;
}
static void Main(string[] args)
{
Foo f1;
f1.abc = 100;
Test(out f1);
Console.WriteLine(f1.abc);
return;
}
}
thanks in advance,
George
|
|
|
|
|
You will get 200. What's the problem here ? If you remove out , you will get 100.
|
|
|
|
|
Yes, N a v a n e e t h!
I got 200. I just want to confirm that when we pass an out variable into a function, we just pass a reference, no additional copy is made?
regards,
George
|
|
|
|
|
Yes the reference is passed and no additional copy is made.
|
|
|
|
|
Thanks N a v a n e e t h,
Question answered.
regards,
George
|
|
|
|
|
I have to do some animation (slide in / slide out) on about 5 images in c# form. For this I have placed a transparent form on which 5 panel with background images and initially set their location out of form so that they will be invisible at start. On start called a routine, which brings those into the form with slide effect. The routine is
-------------------------------------------------code-------------------------------------
void inimationStart()
{
if (this.Visible)
{
panel1.SetBounds(-300, panel1.Location.Y, panel1.Width, panel1.Height);
panel3.SetBounds(-360, panel3.Location.Y, panel3.Width, panel3.Height);
panel4.SetBounds(-400, panel4.Location.Y, panel4.Width, panel4.Height);
panel5.SetBounds(-460, panel5.Location.Y, panel5.Width, panel5.Height);
panel6.SetBounds(-500, panel6.Location.Y, panel6.Width, panel6.Height);
panel2.SetBounds(-560, panel2.Location.Y, panel2.Width, panel2.Height);
this.Refresh();
MessageBox.Show(this.Width.ToString());
for (int i = 0; i < 560; i += 20)
{
if (i < 300)
panel1.SetBounds(panel1.Location.X + 20, panel1.Location.Y, panel1.Width, panel1.Height);
if (i < 360)
panel3.SetBounds(panel3.Location.X + 20, panel3.Location.Y, panel3.Width, panel3.Height);
if (i < 400)
panel4.SetBounds(panel4.Location.X + 20, panel4.Location.Y, panel4.Width, panel4.Height);
if (i < 460)
panel5.SetBounds(panel5.Location.X + 20, panel5.Location.Y, panel5.Width, panel5.Height);
if (i < 500)
panel6.SetBounds(panel6.Location.X + 20, panel6.Location.Y, panel6.Width, panel6.Height);
if (i < 560)
panel2.SetBounds(panel2.Location.X + 20, panel2.Location.Y, panel2.Width, panel2.Height);
this.Refresh();
}
}
} ----------------------------------------------------------------------------------------
But here I cought in few problems
1. when I make the form visible all the panels are visible on the form and then suddenly disappear, whereas I have disappeared those.
2. It’s very slow.
3. some flickering
Could anybody please help me? Thanks.
abrar
|
|
|
|
|
Rather than shifting a bunch of panels, i recomend you just draw the images yourself. To get rid of flickering use double buffering. I forget exactly how you do that, but it should be an option in the designer (for your form) and its pretty easy to google.
You'll want to be drawing the images in your forms OnPaint event, and this is quite simple. You will also need a way to track the location of your pics though and you should use a timer to change these variables so that you get smooth motion, something like this perhaps:
Time myTimer = ...;
myTimer.Interval = 100;
Bitmap imageOne = ...;
int xOne,yOne;
Bitmap imageTwo = ...;
int xTwo,yTwo;
...
void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImageUnscaled(imageOne, xOne, yOne);
e.Graphics.DrawImageUnscaled(imageTwo, xTwo, yTwo);
}
void TimerTick(object sender, EventArgs e)
{
if(xOne < XX)
xOne += 20;
if(xTwo < XX)
xTwo += 20;
this.Invalidate();
}
EDIT: If you use a timer like this and it's still too jumpy, then you're gonna need to use a better timer that the one .Net supplies. Your gonna need to go back in time to timeSetEvent and timeKillEvent from winmm.dll
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi all
I am developing a Voice Chat Application.....
I used DirectSound For Capturing the Audio. Using WaveFormat I am capturing the audio bytes and sending it over the client.....
My client is receiving the Audio Byte...But it is not playing.......
Can anyone tell me what will be the reason.......
Thanks in Advance
Vayanan
|
|
|
|
|
vayanan wrote: Can anyone tell me what will be the reason.......
Their volume is turned off.
Seriously, it's hard to tell if you don't give us more detail. How are you trying to play it ? Is it stored in a file first ? What does the code look like ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I need a code generator which will generate class for my Table adapter (which has insert update delete fillby etc methods). I have tried CodeSmith seems not working with the tnsnames.ora conn string.
If there is any other alternate solution that is also welcomed.
Thanks,
|
|
|
|
|
I don't use Oracle (I downloaded it once and it ground my PC to a halt!), but does any of this stuff[^] from their site help?
Dave
|
|
|
|
|
May be I couldn't express it correctly. I need a c# code for codegenerator which is going to generate code for my Data Access Objects, one like CodeSmith etc does. I have code ready for objects but have to get it for writing Insert update Delete method. I mentioned oracle as most of the tools work good for MSSQL.
Hope you got it!
|
|
|
|
|
Anything here[^] help ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
You want to use an ORM that supports Oracle, right ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Het2109 wrote: Does Anyone has a Codegenerator for Oracle DAL
I have, which is not going to be useful for you, even if I'm willing to give it to you...
You best bet is IF you are using IDbConnection etc, you can swap SQL client to Oracle client using ODNET, with some adjustment to the SQL syntax.
|
|
|
|
|
It's possible I open OpenFileDialog with Windows Impersonation, which show map drives network user impersonated.
Thanks!
|
|
|
|
|
|
Hi friends.
I want to know how I can handle any press keys in my C# form?
Thanks.
Sorry for my English. I'm a freshman .
|
|
|
|
|
look at the events for your form. In particular, you want to look at the following events:
Hope this helps.
dimaj
|
|
|
|
|
I did it, but it doesn't work
Sorry for my English. I'm a freshman .
|
|
|
|
|
Sorry, for some reason my previous message got cropped... Events that I meant originally were KeyUp, KeyDown and KeyPress
dimaj
|
|
|
|
|
With the key press event. What keys are you having trouble with ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If you want to handle key press before it reaches controls set KeyPreview property to true.
If you want to handle key presses even when your form doesn't have focus you will need global keyboard hook. There are several articles about it here at codeproject.
Happy searching.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Thanks guys.
Sorry for my English. I'm a freshman .
|
|
|
|