Visual studio and alpha backgrounds - vb.net

Seen this question asked a lot but can't seem to find an answer. So here it is. Can you use a PNG with an alpha channel as the background image for a VB app? I don't care about changing the shape of the app rectangle is fine. They just want to use a character with a drop shadow behind him as the background for the app.

In WinForms, you'll need to make a layered window.
In WPF, you'll need to set AllowsTransparency to true and WindowStyle to None.

Related

vb transparent background with gradient

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.

ApplicationBarIconButton not displaying

I create images from online at picresize.com to use as application bar icons. I made them 48 x 48. The only thing I didn't do was make the background transparent. Now the icons just show as white blocks and nothing else. This page, http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff431806(v=vs.105).aspx, specifies what should be done but doesn't say a must. Any thoughts or experiences in this happening to others?
appBarButton =
new ApplicationBarIconButton(new Uri("/Assets/AppBar/<my_button>.png", UriKind.Relative));
appBarButton.Text = "<text>";
appBarButton.Click += appBarButton_Click;
ApplicationBar.Buttons.Add(appBarButton);
The transparent background is a must.
Instead of using that picresize.com web service, you should probably learn to use Photoshop, Paint.Net, or any other descent image editor that works on your computer not on someone else's computer.

Soft Brush for Paint App?

Like in Photoshop and many other painting/photo editing program that it lets you set the hardness of the brush.
Is it possible to do this with core graphics? Or I have to use OpenGL
PS. If I have to use OpenGL give me some codes and more details.
try CGContextSetShadowWithColor. The Shadow opacity depends on the shadow-color and the opacity of the drawn object. I believe applying a shadow to a full-tranzparent object is not possible without some masking.
... damn i wanted to add a new comment...

VB2008 Resolution-based resizing

Usually I am a web developer so this is probably a very novice question. I recently made an app in VB2008, but I developed it in a huge reso (1920x1200). The person that will be using it still uses 800x600 reso. Is there any simple way I can resize the entire interface to fit any resolution? I didn't really think about it at all while I was making the program.
I'm not sure if there's any simple way of changing your application. If you were writing an application from scratch I'd suggest looking at the Dock, Anchor, MinSize and MaxSize properties of the controls, all of which are quite useful to make them resize according to the total size of the application. Could be a bit annoying if you have to go in and change them all manually now though.
There's also the TableLayoutPanel control, you can read about it here.

Using System.Drawing to make a selection tool, and cropping an image in vb.net

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