I'm creating a launcher for a game I'm working on.
I don't want the square edges of the Control, so I decided to try the route in making the control transparent, and having the PictureBox image I created as what you will mainly see as the background of the App itself.
I have the Control Transparency working, however, even though I've set the PictureBox.BackColor to Transparent, it still shows a Black background.
Basically, I just wanted my launcher to look a little "3d" with the logo and the edges coming out a little bit. So the control is technically larger than the picturebox to make room for parts coming out a bit.
Can anyone tell me where I'm going wrong?
Related
I want to create a app that lets you draw on screen like Epic Pen. I searched on google on how to do it but all I found was only how to draw static shapes (rectangles etc.) on the screen, not brushstrokes like in MSPaint. I thinked of making the form transparent by using TransparencyKey but it just lets clicks through it.. Is there any way for me to do this, without taking a screenshot and drawing on it? I want users to be able to switch between pen mode (draw on screen) and cursor mode (normal clicking). Example video of Epic Pen:
I am trying to make a game scene for Unity. However, I can't seem to get rid of this border. Or I can't seem to stretch my background to fit the whole screen. I need this scaling to work for all screen sizes. Here is an image of what is happening.
You can clearly see the blue edging, when I don't want that to be happening. This happens when I test on my Tablet as well. The camera is of size 5, however, when I do some debugging, I notice it gives me positions such as 7.15 when I touch on the screen. How can I scale everything down, I have searched through tons of forums and no one seems to be having this issue.
Are you using UI panel for the background? if so try these step.
1st strech the background Panel to fit the whole canvas size
then change the background panel to stretch in all directions
Then select the canvas object and render mode for screen space camera, assign your camera to it and change the UI scale mode to 'scale with Screen size'
I have 3 pictureBoxs each one have transparent image, like this:
To make the picture 2 and picture 3 transparent for picture 1 , I wrote this code:
pictureBox2.Parent = pictureBox1;
pictureBox3.Parent = pictureBox1;
Now, my problem: How can I make picture 2 transparent for picture 3?
There's a limit to how well this will work, you are past that limit when you start to nest images. You'll then see that a PictureBox is only transparent against its Parent, parts of the composite image where other PBs contribute pixels won't be visible. You'll see the Parent's background instead.
You'll need to switch to a single PictureBox and write code. Implement its Paint event handler and call e.Graphics.DrawImage() to draw the images. Layering is now no longer a problem, paint is always transparent against its background. Also the way that WPF implements transparency.
I have a picturebox with a fixed sized image (256x256) generated by the program. I have another smaller image as a resource. What I want to do is when my cursor is over the image and I hold down the mouse button, the smaller image "anchors" with the mouse pointer so it moves around with it. If I let go of the mouse button, the smaller image will stay in that position on top of the bigger image. The smaller image is basically a marker, something like an X or O.
I was thinking of having a second picturebox on top of the first picturebox but I can't make it transparent. Or redrawing the image with the smaller image on top of it and reloading the image into the picturebox, but I'm not sure how to do that and I think it's going to be pretty slow redrawing it each time I move the mouse.
So how can I have a marker image move around on top of a bigger image and have it stay there?
Create your control for this instead of using PictureBox. PictureBox should be used ONLY for fixed images on the form, nothing else.
Instead, derive your control from UserControl. Turn on double buffering for it. In OnPaint method, first draw your background picture, then your marker picture after it. Don't worry, it WON'T be slow and it WILL work as it should.
When you release the mouse, update background picture by drawing your marker picture on it.
Since every sentence here is a little discovery by itself, hope you'll have a good time coding your little game :)
I have made a card game built of pictureboxes. The empty places a card can be put in is an empty picture box with a transparent background and a 3d border. And then I have a current card which is also a picturebox which is moved by a MouseMove event.
As soon as I drag a card over the transparent PictureBoxes there is a card left all over the place where the card has been until I stop the mouse and let the picture refresh. This is also the case when I have the background of the current card set to transparent although a card is set to be the image (so it does not really matter there as it goes away if I set the background to green).
Is there any workaround for this? I tried DoubleBuffered but with no success. Thanks!
It isn't clear from your description what your code looks like. But heads up on your next problem after you get this one fixed: transparency effects for controls do not work in Windows Forms when controls overlap. You'll see the background of the parent, you won't see the content of the picture box that's overlapped by your moving card.
This isn't a problem with WPF, it has a very different rendering model. But as long as you want to stick with Windows Forms, you need to make this work with the form's OnPaint() event. Draw the card table, then the stock, then draw the moving card. When the card moves, call Invalidate() to force the form to be repainted, now showing the card in its new position.
In other words, don't fix your current problem. Redesign your program.
you can call
Application.DoEvents();
in pictureBox.Move events; so all the background pictures will redraw themselves.