|
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.
|
|
|
|
|
I think your referring to normal Gaussian distribution, see here you should be able to rework that code to C#
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
May I suggest...
Pseudo-code...
static void function1 (MyObject o) {
...function operating on o...
}
static void function2 (MyObject o) {
...function doing some other operation on o, or no-op even...
}
void ProbabilityFunction () {
loop {
if (randomNumber < 0.7) {
function1(o);
} else {
function2(o);
}
}
}
Take that pattern and expand it.
BTW, your mistake here is assuming this is more complicated than it is. You have a simple decision, with only two branches - that's the trivial IF situation. Always break down your problem to the simplest possible thing. I think you missed the fact that all you're doing here is a simple IF-ELSE, and there's NOTHING in the ELSE.
Are you planning to have more than two possible functions? Because then, yeah, you need something more complicated, and to be honest, I was hoping you were asking about that. There is a known pattern for that - where you have between 3 and millions of possible functions. When you only have two, it's an IF-ELSE.
|
|
|
|
|
hi,
How can I change the button shape to circle in c#?
help me :]
thanks
nofar
|
|
|
|
|
Trivial in WPF. Quite a bit of work in Winforms. Which are you using?
|
|
|
|
|
i think is winForm,
I use the interface of vb.net
|
|
|
|
|
Look into learning WPF. ONce you know it, it is much easier to do things like that. WinForms is primative in comparison, and has not really changed much since VB 6.0 (dark ages).
|
|
|
|
|
For WinForms, you can simulate it easily by using a PictureBox and hooking the Click event.
What UI are you targetting? C# can be used for WinForms, WPF, ASP.NET, SilverLight, even Gtk.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
But the picture will not be rounded,
I use the interface of vb.net
|
|
|
|
|
Use a picture of a round button and a transparent background
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|