|
The answer is Choice 3 (0,0,30) if Coordinates is a class, or your answer if Coordinates is a Struct
ALL classes in C# are reference types so regardless if you use the ref keyword or not, they are passed by reference. If Coordinates is a struct instead of a Class then the first parameter is passed by reference and the other 2 are passed by value.
|
|
|
|
|
Nope. Just run the code, and you will see the result is 0,30,30 whether Coordinates is a struct or a class.
The Test() method replaces both Coordinates by new ones, however only the first one makes it back to the caller, thanks to the ref keyword; the second Coordinates is just local to Test().
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
What? Are you asking how to convert a bitmap image into a GraphicsPath? You can't.
|
|
|
|
|
So if I have a Trackbar with GraphicsPath as a Tracker , I can't put an Image as GraphicsPath ?
Is there a dll or CustomControl that I can skin with him a TrackBar in WinForm ?
|
|
|
|
|
Epsilone3 wrote: So if I have a Trackbar with GraphicsPath as a Tracker
Uhhh...what? Your subject line suggested you were trying to convert a bitmap image into a GraphicsPath, which is possible, but with great difficulty.
Epsilone3 wrote: I can't put an Image as GraphicsPath ?
No.
Epsilone3 wrote: Is there a dll or CustomControl that I can skin with him a TrackBar in WinForm ?
I think you're asking if there is a way to skin the TrakBar? Not that I know of. You'd probably have to search for a control library that offers one, or write one yourself.
|
|
|
|
|
You asked the reverse twice ( and got the same answer twice, once from me ). It seems to me that you're missing something fundamental here. A path is vector information and a bitmap is raster information. Going vector to raster is easy, the reverse, not so much. You can do it, but expect to spend a long, long time working on it. Expect to end up with something complex enough that it would be salable as a product on it's own. You'd need to find lines in your bitmap, and convert them to paths. Of course, a graphics path cannot recreate a complex bitmap, at least not in a viable way.
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 )
|
|
|
|
|
Thank Christain I miss you last replay.don't got notify mail about her.
Are you know any way ( dll ) CustomControl to Skin TrackBar ?
|
|
|
|
|
I'm sure at least one exists on Code Project as an article, yes.
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 )
|
|
|
|
|
Hello everyone,
I am using the following code to resize the Row of a DataGridView to display the entire data in the row.
<br />
for (int i = 0; i < this.dataGridView3.Rows.Count; i++)<br />
{<br />
this.dataGridView3.AutoResizeRow(i);<br />
}
I was wondering how I can change the size back to what it was before it is AutoResized?
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
How about saving the Size property value of the grid before you call AutoResizeRow?
|
|
|
|
|
Hi
i have a C# 2005 and oracle 9i database
i was install client component for the .NET from oracle 9i
but when i try to run the program he give me an error message "Need Client Component version x.x.x" where x is some number i do not remember it then
i was install client component for the .NET from oracle 10g
but he give me an error message "Can not Resolove TNS name" ?
how i can solve this problem ?????
|
|
|
|
|
Hey there,
slightly puzzled here. You mention two errors. "Need component ... " and "TNS resolving .. "
There reason why I'm confused is that the TNS resolution error cannot occur unless you've established a proper connection to the host, regardless it's local or remote. And to establish a successful connection you need the Oracle Client Binary referenced in your code. If you've referenced the Oracle Client , the DataAdapter will then use that particular Library. I cannot comment on why it would give the "Need Client .." error, as it seems almost impossible to me.
Basically all you need to do is copy the Oracle DLL to your /Release or /Debug directory and add that DLL as a reference.
As for your "Cannot resolve TNS name" you need to know a little bit about how Oracle works. An Oracle TNS name is basically an entry pointing in the TNSNAMES.ORA file that points to a particular oracle database instance. You might want to check that and set it up. Once this configuration is done you can use the ODBC Administrator to add an Oracle DSN. In the Oracle ODBC Driver Configuration window, in the TNS Name Service text box, you can enter the net service name as you entered it in the setup , or you can enter the fully qualified net service name as it appears in the tnsnames.ora file.
I personally think it's not really an error in your code but merely a configuration mistake in setting up Oracle or the DSN.
Hope this helped.
Cheers
|
|
|
|
|
I need to pass struct MyStruct to another assembly. Please help me and share the code also (if possible).
Thx
A
|
|
|
|
|
I'm not sure what you mean
Foo(MyStruct)
only two letters away from being an asset
|
|
|
|
|
Ok for example
1) I have one assemble say A where i have struct "Mystruct" as
struct Mystruct(
int i;
int j;}
2)Now i am consuming method of another assembly in assembly A
dim myobj as new MyObj
myobj.Calc()
Now calc expects structure ...So how i can pass it?
A
|
|
|
|
|
As long as the assembly B has a reference to Assembly A, for MyStruct
myobj.Calc(struct)
What are finding difficult about this?
only two letters away from being an asset
|
|
|
|
|
getting type expected
Can you share simple source code for both the assempblies....It would be gr8 help....Just very simle code in C# for CLass A and B....
|
|
|
|
|
I'm a beginner in C# and I tried to make a console program where you enter a number, then the program tells you if your guess was too low or high, and you keep guessing until your guess is correct. I really thought that my code would work, but it doesn't. Can anybody please guide me in the right direction?
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Random a = new Random();<br />
int counter = 0;<br />
int guess;<br />
int rand = 0;<br />
rand = (int) a.Next(0,10);<br />
<br />
Console.Write("Enter your guess: ");<br />
guess = Console.Read();<br />
<br />
while(guess != rand)<br />
{<br />
if(guess > rand)<br />
{<br />
Console.WriteLine("Wrong number, you aimed too high");<br />
}<br />
<br />
if(guess < rand)<br />
{<br />
Console.WriteLine("You aimed too low");<br />
}<br />
<br />
Console.Write("Please guess again: ");<br />
guess = Console.Read();<br />
counter++;<br />
}<br />
<br />
Console.WriteLine("Congratulations, you rock!");<br />
Console.WriteLine("It took you {0} tries", counter);<br />
}<br />
}<br />
}
|
|
|
|
|
Husker47 wrote: my code would work, but it doesn't
???
|
|
|
|
|
Your problem is with the call to Console.Read() - the integer that it returns is the Ascii value of the first character entered by the user. Use this instead:
int.TryParse( Console.ReadLine(), out guess);
The call to Console.ReadLine() reads the entire line of input supplied by the user, and then int.TryParse() attempts to parse that string into an integer value. TryParse returns a bool to let you know if the string could be parsed correctly or not. You'll probably want to add some error handling for when the user enters something that isn't a valid integer value, but that's totally up to you.
|
|
|
|
|
Thank you so much for your help, it works just as I hoped.
|
|
|
|
|
Glad to help
|
|
|
|
|
hello
has anybody tried to deselect a row of the datagridview?
i try to deselect a row, but the rowheader ALWAYS indicates a select row,
i aleady tried to use:
ClearSelection()
.Selected = false;
but nothing works. the "highlight" in the row disappears, but the rowheader indication not. then, if I try to verify the row to select it again, it never works, because the row is always selected.
anybody knows the solution?
thanks a lot again
|
|
|
|
|
Try:
Grid.MultiSelect = false; // surely clear all selections
Grid.MultiSelect = true; // return Grid state back
|
|
|
|