I am currently writing a program that requires a picture box with a transparent image to go over several pictureboxes. I have looked for hours now and found nothing useful. the program is a rubiks cube solver. each square is represented as a picturebox and the cube is shown in a net form. I cant upload images as my account is new but i have included an image of a rubiks cube in a net form. now imagine a semi transparent image going over some of the squares (pictureboxes) to represent a visual guide to the rotation about to be made in the solve process. If you need more info I will do my best and upload images and add code for better clarification if needed. If this is not possible is there any alternatives that I could attempt? Thankyou
I don't think what you want is possible. I was actually trying to solve the same problem about 2 days ago and to no avail. You can't have transparency to work with multiple pictureboxes on winforms. What you need to do is draw the images using Graphics like one over the other. Use 1 picturebox and do Graphics to overlay the picture on the picturebox. Or have the main picture as the form's background image and use pictureboxes, this was what I did. This is surely easier using WPF. Alternatively... Try to check this imaging SDK.
http://www.gdpicture.com/
This might help overlaying your images.
And this too, this is basically the one using 1 picturebox and overlaying using Graphics.
VB.NET Winforms: Overlay two transparent images
Related
I am working on just a small game in Vb.net (I know this is not a great place to make a game but I'm just doing a little project). I have a project set up where I am trying to make an isometric tile map. To make it easier on myself, I wanted to get all the locations set first, so I took picture boxes and found the exact locations for where I want to draw each tile. Now what I would like to do is draw an image at each location and I'm not sure how to go about this.
(something like, for each picturebox.location draw graphics.tile1????)
thank you!
In certain programs and applications, when I looked at their installation files they had some images only a few pixels say 40px in height and 1px in width.
I learned from that time that image files are used seamlessly to create textures for certain parts of their programs "window" or "form".
I would like to know how to recreate this in visual basic. Let's take a simple example to use: I have a panel and inside this panel I want the seamless texture to repeat so that when the user re-sizes the form the image isn't cropped or not visibly stretched.
Also take the example of the image below showing the title bar in iTunes.
(I have already tried searching examples of this, but I don't know what the method is called and online results focus mainly on the words "seamless" and "design", showing things like Illustrator)
Background image in Tile or Stretch mode
I have a problem with gradients transparency key in a PictureBox in visual basic form . I want to get a good transparency as it is in the first form (in PS)
That's what I did:
1- Drawed the picture in Adobe Photoshop (CS6) with these preset:
2- Saved the picture with this option:
3- Added the picture to a PictureBox in vb form with blue BackColor
4- Changed form TransparencyKey to blue
5-The (awful) result:
The Form.TransparencyKey property is not really what you're looking for. It will only make the parts of the image transparent that exactly match the color you specified (Color.Blue, in your case). That means that the parts of the gradient in your image that have even a remotely small amount of red or yellow in them won't match the filter.
Among the things you could try is to have your form drawn with alpha blending. Here's a library that lets you draw stuff with transparency, which looks like what you want.
Alternately I dug up a walkthrough on CodeProject. It involves a lot of chatting with forms interop and the OS, which might not be your cup of tea.
Note that GDI+, the system Windows Forms uses for drawing, is somewhat slow, especially when drawing images. I don't know what your project looks like, but if you're going to draw a lot of transparent images, I suggest looking towards Microsoft DirectX.
I am creating a game in SpriteKit in which I have some SKShapeNodes. I want the SKShapeNodes to be hidden by color. For example:
initially as the scene loads, it should show as plain color.
The user scratches (touches and moves touch) to scratch the color and reveals the shapes behind the color. I will perform other actions on these shapes later
If any one suggests this link:
https://github.com/moqod/iOS-Scratch-n-See
then I have already gone from this but the problem is this that it is using two images one as front and other as background and it is in core graphics. I am completely beginner to core graphics and having difficulty to understand how to show color instead of image to scratch.
I understand that the question has been already asked but it is using images. I want to have only one color as layer which will be scratched.
Any one will please help me how to achieve scratch effect to scratch color and reveal other nodes behind?
If i wanted to crop an image in VB.net, how would I go about doing it? I am trying to let the user drag out the box they want (system.drawing.rectangle), and it will automatically remove the edges surrounding the box.
My first problem is primarily the fact that I cannot make the system.drawing.rectangle visible. It is not displaying at all, I am setting its location and height programmatically, but nothing is showing up. I know there is probably something fairly obvious I am missing...but I cannot seem to find it.
My larger issue, however, lies with the cropping itself. I cannot find any crop methods, at all. Is there a hidden one I am missing? Or must I code it myself? How would I go about doing this? It ought to be able to output to a bitmap image object.
Thanks for the help, I am surprised this hasn't been asked on here before....
Regarding your first problem: a Rectangle isn't by itself visible. You have to draw it on your canvas using the Graphics object's DrawRectangle(...) method. For drawing a selection tool, you'll want to set your Pen object's DashCap and DashPattern properties.
To "crop" an image, you basically want to take the portion of a larger image delineated by a smaller Rectangle, and turn it into a new Bitmap. This can be done using one of the 30 overloads of the Graphics object's DrawImage(...) method. You can either keep the cropped portion in its original dimensions (resulting in a smaller Bitmap than your original), or you can "blow it up" to something like the original image's size. If you do the latter approach, it is usually a good idea to set your Graphics object's InterpolationMode property to HighQualityBicubic (I think that's the one, anyway), since the default InterpolationMode is pretty crappy.
There are a number of different ways of rendering images in .Net - it might help if you posted some of your code, along with an explanation of the exact problems you're running into.
Here is another answer with a link to a sample app (and source code in C#, sorry) that may help you get started.
There are a number of articles on these topics on CodeProject:
Pick your favorite flavor (though I encourage you to check out the C# projects - it shouldn't be too hard to convert).
VB
Image Cropping with Image Resizing Using vb.net
C#
Cropping Images
An Easy to Use Image Resizing and Cropping Control
Image Processing using C# (see the Cropping section - I was able to use this code in one of my projects)
WPF/C#
WPF Interactive Image Cropping Control
A Photoshop-like Cropping Adorner for WPF