|
how to play a song using MCI ?(C#)
|
|
|
|
|
|
don't know whether this link solves your purpose, please specify which file format you want to play?
and please google first, before posting
http://www.codeproject.com/KB/audio-video/moemeka7.aspx[^]
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
How to create Round(Circle Shape)Button in C#?
|
|
|
|
|
|
// This method will change the square button to a circular button by
// creating a new circle-shaped GraphicsPath object and setting it
// to the RoundButton objects region.
private void roundButton_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath buttonPath =
new System.Drawing.Drawing2D.GraphicsPath();
// Set a new rectangle to the same size as the button's
// ClientRectangle property.
System.Drawing.Rectangle newRectangle = roundButton.ClientRectangle;
// Decrease the size of the rectangle.
newRectangle.Inflate(-10, -10);
// Draw the button's border.
e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle);
// Increase the size of the rectangle to include the border.
newRectangle.Inflate( 1, 1);
// Create a circle within the new rectangle.
buttonPath.AddEllipse(newRectangle);
// Set the button's Region property to the newly created
// circle region.
roundButton.Region = new System.Drawing.Region(buttonPath);
}
|
|
|
|
|
Is it possible to get an approximate sum of S defined as 1/2 + 1/4 + 1/8 to a certain number of counts? Say up to 1/16?
If so how does one write such a code in c# to achieve this?
Thanks
|
|
|
|
|
Angelinna wrote: If so how does one write such a code in c# to achieve this?
Personally speaking, I'd use a loop. It's the simplest way.
|
|
|
|
|
Just how does a loop get applied in this case.
|
|
|
|
|
You could use a Fraction/Rational number class or find the GCD of all the numbers, multiply them by the GCD, sum them all, then divide by the GCD.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
You can get much better than an approximation, you can get the exact value.
The sum of (1/2 + 1/4 + 1/8 + ... + 1/n) is (1 - 1/n).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Would this operate as a recursive function? If not, how best can one
implement the summation recursively.
|
|
|
|
|
Why would you do that as a recursive function? It's a very simple calculation. There is no looping required of any kind.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Good point. I should have thought of that. I've been out of school way too long.
|
|
|
|
|
|
Thanks all for your guidance. I am trying to have it all programmed in c#.
|
|
|
|
|
Hi everybody,
I uses Interop.Excell.dll to modify excel file then it worked fine if I chosen the computer's region was English. But the problem happened when i changed to another different with English; Some of function could not work. For Example :
I used this function to change the condition of cellItem
cellitem.FormatConditions[1].Modify(XlFormatConditionType.xlExpression, XlFormatConditionOperator.xlEqual, "=AND($X$" + position + ">2,MOD($X$" + position + ",2)=0)", "");
-With the region is English it still ok.
-With the region is Germany I had error exception:
{"The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}
OS: Window XP professional.
I think that:"The reason is some functions of that dll can not work with the difference formats(currency, datetime, number...) doesn't like English format." I try to find the correct dll using in Germany location but untill now I do not find out it or find out another solution.
Have anyone ever done in this situation and solved it! Please help me.
Thanks,
|
|
|
|
|
if i use varchar(max) instead of varchar(50), and use "chandra" only , then will both give the same performance.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Mogaambo wrote: then will both give the same performance.
Same performance of what? Actually what is this doing in the C# forum? It should be in SQL...
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
i am creating tables on runtime, after reading from a text file but i don't know the datatype size, so if i use varchar(max) will that okay.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Again, please use the SQL forum, NOT C#!!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
It won't make any significant difference to the performance of your C# code.
|
|
|
|
|
Hi,
I made a custom control inherited from 'Button' control.
I made a custom event 'Action' in this userControl I made a access specifier 'public'.
like this :
public delegate void ActionEventHandler(object sender,ActionEventArgs e);
public event ActionEventHandler Action;
protected void OnAction( object sender, ActionEventArgs e)
{
if ( Action != null)
{
Action(sender,e);
}
}
but when I drop this control to a form it doesn't show 'Action' event
in property window.
plz help how to do this...
|
|
|
|
|
|
Ok, i am still having some trouble with the code. I have a controller on the other side with a thermometer and keyboard etc.
I am sending the temperature from there to my form. It normally works fine.
The only time it gives me an error is when the first thing i do (after turning on the controller) is click "show temperature" on my screen form. Then the error that occours is the following:
Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
It also says:
TargetInvocationException was unhandled.
Exception has been thrown by the target of an invocation.
Could it be that the forst time data is in some kind of wrong format? How to make sure that the window handle will be created before BeginInvoke?
Sample code: namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int ledStatus = 0;
int r = 2;
System.IO.Ports.SerialPort sp = new System.IO.Ports.SerialPort();
public Form1()
{
InitializeComponent();
sp.PortName = "COM5";
sp.BaudRate = 19200;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.ReadTimeout = 5000;
sp.Open();
sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
}
void sp_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
this.BeginInvoke(new Action(UpdateData), sp.ReadExisting());
}
public void UpdateData(string character)
{
if (r == 1)
{
string ajutine2 = "0";
ajutine2 += character;
int stringToInt = Convert.ToInt32(ajutine2);
for (int y = 0; y < 1000; y++) ;
if (stringToInt > 100)
progressBar1.Value = stringToInt;
double intToDouble = Convert.ToDouble(stringToInt);
double ajutine3 = intToDouble / 10;
string doubleToString = Convert.ToString(ajutine3);
ekraan1.Text = "";
ekraan1.Text += "Temp: ";
ekraan1.Text += doubleToString;
ekraan1.Text += " *C";
}
else if (r == 2)
{
for (int y = 0; y == 5000; y++) ;
ekraan1.Text += character;
}
}
... }
|
|
|
|