|
hi all,
i need to make an application that use a changable form's opacity
that when i change the value of a NumericUpDown control
the value of the form's opacity change
and that what i trayed to do
private void numericUpDown1_ValueChanged_1(object sender, EventArgs e)<br />
{<br />
this.Opacity =Convert.ToDouble(numericUpDown1.Value);<br />
}
but it didn'n work
the form's opicity didn't change
can i do what i need or that's not allowed in C#?
thanks in advance
and sorry for my English
|
|
|
|
|
adel_soli wrote: Convert.ToDouble
Here's your problem. The opacity is a value between 0.0 and 1.0. Your numeric up down control isn't showing doubles. Did you stop to think why it needed a double ?
this.Opacity = numericUpDown1.Value/100.0;
will work, assuming the range of the control is 0 - 100.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
sorry christian
but it didn't work
it gives me the following error
Operator '/' cannot be applied to operands of type 'decimal' and 'double'
|
|
|
|
|
I would urge you to give up on this project, buy a book on C#, and work through it. The problem is simple - you need to cast one of these to double, or the other to Decimal, so they are both the same type.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
of course i trayed to cast one of these
but it also didn't work
the opicty didn't change
|
|
|
|
|
Or maybe it only changed by a little bit?
this.Opacity = (double) numericUpDown1.Value ;
Using a numericUpDown1 that ranges from 0 to 1 with two decimal places.
|
|
|
|
|
Personally I think the Convert class is needless and confusing; it should be deprecated.
|
|
|
|
|
Hi All,
I have created a project that exports data to Excel. I take some samples and display it using excel. I have 4 columns: time, X, Y, Z data. The X,Y,Z data is integer data and exports perfectly. The time column doesn't work. I create the array and then I try to export it, but for some reason with double it changes all the array to the first time value .1s and if I have it as a string instead it changes all the values in the array to the final read value. Does anyone know how to display the time. I am taking a sample every 100ms so I am trying to do an elapsed timer. Please help. Below is my export to excel function:
<br />
private void button2_Click(object sender, EventArgs e)<br />
{<br />
timerTakeData.Enabled = false;<br />
radioButton10.Enabled = true;<br />
radioButton100.Enabled = true;<br />
radioButton20.Enabled = true;<br />
radioButton200.Enabled = true;<br />
radioButton50.Enabled = true;<br />
button1.Enabled = true;<br />
<br />
labelTime.Text = "0.00";<br />
Excel.Workbooks ExcelBooks;<br />
Excel.Sheets ExcelSheets;<br />
Excel._Worksheet ExcelSheet;<br />
Excel.Range range;<br />
timerTakeData.Enabled = false;<br />
radioButton10.Enabled = true;<br />
radioButton100.Enabled = true;<br />
radioButton20.Enabled = true;<br />
radioButton200.Enabled = true;<br />
radioButton50.Enabled = true;<br />
button1.Enabled = true;<br />
<br />
labelTime.Text = "0.00";<br />
Excel.Workbooks ExcelBooks;<br />
Excel.Sheets ExcelSheets;<br />
Excel._Worksheet ExcelSheet;<br />
Excel.Range range;<br />
try<br />
{<br />
ExcelApp = new Excel.Application();<br />
ExcelBooks = ExcelApp.Workbooks;<br />
ExcelBook = ExcelBooks.Add(Missing.Value);<br />
ExcelSheets = ExcelBook.Worksheets;<br />
ExcelSheet = (Excel._Worksheet)ExcelSheets.get_Item(1);<br />
<br />
ExcelSheet.Cells[1, 1] = "Time";<br />
ExcelSheet.Cells[1, 2] = "X A/D";<br />
ExcelSheet.Cells[1, 3] = "Y A/D";<br />
ExcelSheet.Cells[1, 4] = "Z A/D";<br />
ExcelSheet.get_Range("A1", "D1").Font.Bold = true;<br />
ExcelSheet.get_Range("A1", "D1").VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;<br />
<br />
range = ExcelSheet.get_Range("A2", Missing.Value);<br />
range = range.get_Resize(cnt, 1);<br />
range.set_Value(Missing.Value, time);<br />
range = ExcelSheet.get_Range("B2", Missing.Value);<br />
range = range.get_Resize(cnt, 1);<br />
range.set_Value(Missing.Value, xVolt);<br />
range = ExcelSheet.get_Range("C2", Missing.Value);<br />
range = range.get_Resize(cnt, 1);<br />
range.set_Value(Missing.Value, yVolt);<br />
range = ExcelSheet.get_Range("D2", Missing.Value);<br />
range = range.get_Resize(cnt, 1);<br />
range.set_Value(Missing.Value, zVolt);<br />
ExcelApp.Visible = true;<br />
ExcelApp.UserControl = true;<br />
}<br />
catch (Exception theException)<br />
{<br />
String errorMessage;<br />
errorMessage = "Error: ";<br />
errorMessage = String.Concat(errorMessage, theException.Message);<br />
errorMessage = String.Concat(errorMessage, " Line: ");<br />
errorMessage = String.Concat(errorMessage, theException.Source);<br />
<br />
MessageBox.Show(errorMessage, "Error");<br />
}<br />
cnt = 0;<br />
clockCnt = 10.0;<br />
}<br />
|
|
|
|
|
i want to know how to use (wpf)....
|
|
|
|
|
|
Does google not work where you live ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I am trying to do a simple math division function. I am trying to divide 10/100.
This is the line of code:
double test = 10/100;
I always get 0. I want to be able to get .1, what am I doing wrong? Please help!
|
|
|
|
|
double d = 10.0 / 100.0;
led mike
|
|
|
|
|
Hi,
10/100 is an integer expression, its value is positive and less than one, hence zero.
The fact that you want to assign its value to a double is irrelevant during
the evaluation.
|
|
|
|
|
So to make 10/100 result in 0.1 , U can use 10.0/100 or 10.0/100.0 as they said.
But, if it is a variable like:
int a=10,b=100;
then U will have to typecast it like
a/((double)b).
Regards,
Arun Kumar.A
|
|
|
|
|
Does anyone knows a software that emules the Pocket at PC?
Something like: I link the Pocket at the PC and I use the pocket from PC.
??
Thanks all..
Att.
|
|
|
|
|
You mean apart from the Emulator that comes with Visual Studio .NET Standard Edition and above?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi,
I am developing a project in which I will read data values (as nXn number matrix) from a text file and load a field like sudoku. Sometimes I will change backcolor of cells to gray. How can I achieve that. Should I use graphics library or images (jpg or gif). Which one is easier? Also I will not know how big the matrix is. I will read it from file and load field accordingly.
silence
|
|
|
|
|
Sounds like you need to set up a data structure which you then use to render your field. I'm not sure what you mean by 'graphics library', but just drawing images you load from resources should be fine.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi everybody,
i really don't know how to give a name to this... but how can i make shortkey detector like in VS Express C# that handles something like CTRL+D,S ????
thanks
|
|
|
|
|
AFAIK there's no built in solution so you'll have to write custom logic and track the states yourself.
You'd need to do it in the forms OnKeypress event (or one of the related ones). You'll also need to enable the KeyPreview property.
IF you meant ALT+D,S that's done via two seperate menu shortcuts. Ctrl-Shift-X would be a single shortcut.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
thanks... i've got to dive a little bit more into event handlers and key events :P
thanks
|
|
|
|
|
Hi All,
I have developed an FTP client. When I try to download some of the files I get the error "dst_dataconn ended unexpectedly" with error code 550. Does any one know why this error pops.
Sri
|
|
|
|
|
Amazingly enough I just googled ftp error codes and it gave me a list of all the ftp error codes.
Maybe you should try.
|
|
|
|
|
I am getting a strange problem when I try to run a program for my C# class.
I need to input 10 numbers each into an array, and use two arrays. Then I need to extract each of the numbers and their corresponding numbers in the second array. These two get added together and stored into the third array.
I can get my numbers into the two arrays. When I press Enter, I end up getting a message that there was an exception and it wants to e-mail it to Microsoft. Below is my code for displaying the results. At one time I could at least, get it to do a Console Write Line.
Can anyone see where I’m making my mistake? I am only looking to find out why it is giving me the error message, and trying to send it to Microsoft. Any help would be appreciated.
public static void DisplayNumbers(double anArray1, double anArray2, double anArray3)<br />
{<br />
string results = " "; <br />
int counter = 0;<br />
<br />
for (int x = 0; x < anArray3; x++)<br />
{<br />
anArray3 = anArray1 + anArray2;<br />
Console.WriteLine();<br />
Console.WriteLine("{0}\t" + "+" + "\t{1}\t" + "=" + "\t{2}", anArray1, anArray2, anArray3);<br />
while (counter < 10)<br />
{<br />
counter++;<br />
results += "{0}\t" + " + " + "\t{1}\t" + " = " + "\t{2}" + anArray1 + anArray2 + anArray3;<br />
}<br />
string caption = "Array Methods Illustrated";<br />
string outputMsg = "Array Numbers Shown\n\n" + "First\t" + "Second\t" + " " + " Sum\n";<br />
MessageBox.Show(outputMsg, caption);<br />
}
This is what the exception looks like along with what is on line 18.
“Unhandled Exception: System.IndexOutOfRangeException: Index was outside the
bounds of the array at Exer4Chpt7.Program.main<> in G:\Programs\Exer4Chpt7\
Exer4Chpt7\program.cs: Line 18
Line 18: double[] anArray1 = new double[10];
From what I've been taught in class I figure that this should work. Thanks again.
|
|
|
|