|
By picking up a beginners book on C# and working through it.
|
|
|
|
|
I would also recommend that you bookmark this site while you are learning the basics
MSDN Developement for beginners[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
This can't be a real question. Please give us more information.
|
|
|
|
|
it is a real question but a very simple one
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
You could start by reading some basic books on C#.
|
|
|
|
|
Hi
I am really confused about some code i want to write in c#
What i want to achieve is:
Plug in a USB device and read the contents. For example if i have a .txt file in my USB, i can plug it is and copy that file from my device to my desktop.
Please help and all answers will be very much appreciated.
|
|
|
|
|
A USB device when plugged in is treated as a removable disk, so all you need is the path to the file and you can read it with one of the System.IO classes[^].
Use the best guess
|
|
|
|
|
USB is a bus, not a port, not unlike the expansion slots inside your computer. How you talk to a device that's plugged into a USB port is up to the device and how it presents itself to the bus.
|
|
|
|
|
|
I use this code for make transparent png background this work but I get flick when pictureBox1 moving (pictureBox1 display for webcam), any idea?
pictureBox1.Controls.Add(pictureBox3);
pictureBox1.Controls.Add(pictureBox4);
pictureBox1.Controls.Add(pictureBox5);
pictureBox1.Controls.Add(qPanel1);
pictureBox3.BackColor = Color.Transparent;
pictureBox4.BackColor = Color.Transparent;
pictureBox5.BackColor = Color.Transparent;
pictureBox3.Location = new Point(60, 536);
pictureBox4.Location = new Point(349, 536);
pictureBox5.Location = new Point(638, 536);
this sample when pictureBox1 move and going to flick http://imageshack.us/photo/my-images/707/19041381855.jpg/?sa=0[^]
|
|
|
|
|
In your question, you ask about the png image file format[^]. In your code, you're using several PictureBoxes.
I'm missing the connection. I know, of course, that an image can be displayed using a PictureBox. But what are you actually trying to achieve by patching several of them over one another?
Ciao,
luker
|
|
|
|
|
i want to patching of them over one another?
|
|
|
|
|
The image is probably already transparent. The PictureBox control on the other hand will never be transparent.
|
|
|
|
|
Dave is right. Windows Forms does not support true transparency at all (well, except for the top level form). There are many workarounds involving CreateParams and Painting and none of them work well.
If you want transparency, you want WPF.
|
|
|
|
|
Hey all. First all let me say I am following this guide here: [^]
I simply cannot just change the exe (notepad) to another application, it just doesn't work. What can I do to alter this so something like an emulator can have the same effect? I see in the notes below this project that many users have issues getting this to work with something other than notepad.
I am also open to resources/guides much newer than this, just through my research I have found this to be the 'simplest' way of accomplishing what I am after. Thanks for any assistance!
|
|
|
|
|
The technique is also a hack and not guaranteed to work with all applications. There will simply be some applications that do not render properly when you parent their window to another application.
But, you may want to look at this[^] as an alternative to the article you're linking to.
|
|
|
|
|
Yeah I tried that as well, it works as intended, but you can still move the application around inside and resize and such. Is there a way to cut off the bnorders so it can only be resized via the application I create?
|
|
|
|
|
You can set Window Styles after creating using SetWindowLongPtr[^] followed by a call to SetWindowPos[^]. Not all styles can be changed, but if the ones you need can be then it should work for you.
|
|
|
|
|
You will have very limited control over the target window. It's a seperate process from yours. You don't own it and you can't really control how it paints and behaves outside of setting style bits in the window, which was explained to you by the "other Dave".
|
|
|
|
|
Thanks, it makes complete sense, as the guy said below I doubt I'll be able to do what I want here. It would explain why Notepad is the only thing that I can get to function correctly, not a big deal was just wanting to fool around with it haha. Thanks for all your input, Daves.
|
|
|
|
|
You don't embed an exe in your program.
You can send it out along with your package and call it from your own executable.
|
|
|
|
|
I have created a genetic algorithmic program, but when it comes to doing the crossover or mutation probability I am having to do this by hard coding the function. So My default crossover is a 70% chance of the method body running depending on the result of a random generation, I am using a random number between 1 and 10, storing 7 numbers in an array and checking if they are 8, 9 or 10 is selected then the method body does not run.
Here is my code:
for (int i = 0; i < 7; i++)
{
pc[i] = random3.Next(1, 11);
}
int n = random3.Next(0, 7);
if ((pc[n] != 8) && (pc[n] != 9) && (pc[n] != 10))
{
label58.Text = "YES!";
}
else
{
label58.Text = "NO!";
}
I would like a better way to do this so I can choose a percentage probability by asking the user to enter a percentage. In real life the mutation probability is around 0.001, when it comes to this, I am having issues figuring out the best way to do this.
I would greatly appreciate your advice.
|
|
|
|
|
Why don't you just check if pc[n] >= 8? Unless I'm missing something. You can also input the percentage and check for pc[n] >= nThreshold or whatever.
|
|
|
|
|
I need to do something 70% of the time so generating a random number between 1-10, if a number was between 1 and 7 including 7 then do the code. So for 0.001% would I generate a numbers between 1-1000 and if the number 1 is selected then do the code?
Thanks!
|
|
|
|
|
Yeah, if you generate a number 1-10 and only run at <= 7, that'll be 70% of the time assuming the random number generator has an even distribution.
|
|
|
|