Use Graphics.CopyFromScreen To Enable Alpha Transparent Controls?

Jun 27, 2012

I am trying to use (and this may be my problem already) e.Graphics.CopyFromScreen() in the OnPaint() method of my control to prepare a background onto which I can draw the content of the control. The goal is a tool-tip with rounded corners and other specific features to replace the default Windows tool tip.

Ideally the tool tip could be antialiased and blended into the backdrop, however at a pinch I could tolerate an aliased boundary. This may also be necessary as the control will often be covering a control with an OpenGL overlay and the whole blending procedure may end up a nightmare.

I have created a custom user control, a persistent instance of which belonds to my applications's main form, overriding the OnPaint and OnPaintBackground methods. The application of transparency however is challenging. As I understand, the graphics object passed to the paint method starts with a copy of the current VisibleClipBounds, where generally the first move is to clear the control with a solid colour and start drawing the main features. My first thought was to bypass the fill and start drawing on the captured background. For the first redraw this works fine, but subsequent redraws keep the previous content instead of re-capturing the backdrop. I hoped that CopyFromScreen would specifically eliminate the currently drawing control from its capture so as to start from a clean base but this is not the case, it captures the rectangle of the new location including the image of the previous location if it is in the bounds.

View 1 Replies


ADVERTISEMENT

C# - Graphics.CopyFromScreen Creating Blank Image

Sep 19, 2011

I am using VB.NET to try and capture a portion of the screen so I found this code in several places to capture the whole screen:

Dim screenSize = SystemInformation.PrimaryMonitorSize
Dim bitmap = New Bitmap(screenSize.Width, screenSize.Height)
Using g As Graphics = Graphics.FromImage(bitmap)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screenSize)
End Using
bitmap.Save("c:scratchscreenshot.png", System.Drawing.Imaging.ImageFormat.Png)

This works with no error throw and the file is created successfully but the resulting image is completely transparent (it is the correct size) - This question relates to the same error but the solution is to use Win32 GDI which I want to avoid if possible

View 1 Replies

Alpha Transparent PNG Form Too Slow?

Mar 5, 2011

I have problems with transparent form problem is that its too slow example if i click on button where it should just switch another panel control it takes 3-4 seconds because of redrawing [url] so at form load is called redraw() and if i click on a button and panel is switched i again call redraw() form load 6 second switching panels 3-4 seconds

View 1 Replies

Make Userform Transparent But Have Non-transparent Controls?

Mar 7, 2008

Question:Is it possible to make a userform transparent but have non-transparent controls?I notice changing the opacity of the userform will change the opacity of controls embedded on it.

View 9 Replies

Semi-transparent Menu Over The Top Of XNA Graphics

Jan 16, 2012

I am making a 2D sports game using XNA graphics. I would like to create a drop down menu from which the user can select various tactics. The menu will be a panel so that I can add in various sliders and check boxes, and it will drop down when the user clicks or hovers over a button.

[Code]...

View 15 Replies

Transparent Graphics Surface In Program?

Jun 3, 2010

I am making an application in VB.NET that allows a user to highlight some text in images of documents so that the highlights could be saved for future reference, but the original images would not be modified. I figured I can achieve it by creating a graphics out of an image file and allowing the user to draw on that graphics. The problem is - the graphics can not be created from indexed image files, which many of mine are. I am wondering: is it possible to create a transparent graphics surface above an image in a PictureBox control, so that the user could draw on that surface, but it would appear as if he is drawing directly on an image?

View 3 Replies

Interface And Graphics :: Disable/dis-enable A Window In WPF?

Mar 27, 2011

How can I disable/dis-enable a window in WPF, similarly to what is automatically done while a msgBox is visible. I would like to have the main window disabled while another window is on top, but I can't figure out how to do this.Also, I'd like to know how to not have the other window show up in the Windows Toolbar....

View 2 Replies

Interface And Graphics :: Groupbox And Transparent Background?

Feb 7, 2009

on the form i have a groupbox with a few textboxes and labels inside of it. Behind the group box i have a picturebox image. I want this image to be seen around the textboxs etc.. through the groupbox

Ive tried changing the background colour in the properties to transparent but you can still see the background colour and so the groupbox covers up the picture.

I want the background of the groupbox to be completely transparent.

View 9 Replies

Interface And Graphics :: How To Make Picturebox Transparent

Aug 23, 2009

i am making a program with graphics and im using a picturebox for a button. The image inside picturebox is transparent .gif. The problem is that i don't know how to make picturebox transparent. I searched the internet but all exaples didn't work. Does someone know how to fix this problem?

View 4 Replies

Interface And Graphics :: Transparent Sprite Background

Aug 27, 2009

I made a game in VB 08 and I have sprites and a background but I need to know how to make the background of the sprites transparent.I'd like to note that I'm using a picture box for my sprite, and the game is animated (I read that those things are relevant).I've read a lot on bitblting but I don't understand it, and when I found a helpful article it mentioned to use the .hdc. This article though was made before the introduction of GDI+ which now makes it harder to obtain said .hdc.

View 11 Replies

Interface And Graphics :: [VB2005] Enable Import Button In The GUI?

Nov 20, 2008

how to enable the "import" button when at least one of the checkboxes is checked.I have two buttons : "Deselect all" and "Select All" for the checking of the boxes, to import the specific files' data they want to Excel. (the files are in listbox, and the checked boxes is for selecting the files' parameters that they want to see in excel)

One option:When the user deselect all, the "import" button is suppose to be disable to prevent the user from importing the files' data parameters.

2nd option:(if i do not want to disable the import button) or show message that they have to select at least one box and at the same time, prevent the import button to work if there's no checked checkbox. So my deselect all button code :

Code:
CO2checkbox.Checked = False
NH3checkbox.Checked = False
DBcheckbox.Checked = False

[code]....

but the button still remain disabled if I click "unchecked all" button and then checked at least one box. how do I enable it?And how do i...show error message and prevent the files' data to be imported when the user click "import" when there's no checked checkbox if I choose the alternative option of using message to alert them without disabling the button and yet prevent importing of data?

PS: If I did not click "deselect all" button but click the "select all" button, the import button is enabled and working.

View 12 Replies

Draw Semi-transparent Text On A Graphics Object?

Mar 15, 2010

I want to draw a text with 32 bit transparency on a graphics object. When I try, I only get black color in the result.

If I try to draw a line with the same semitransparent color, it works perfectly.

I have this code:

lBitmap As New Bitmap(32, 32, PixelFormat.Format32bppArgb)
lGraphic As Graphics = Graphics.FromImage(lBitmap)
lGraphic.SmoothingMode = SmoothingMode.HighQuality

[Code]...

I was thinking it may be that SolidBrush does not support transparency, but I found a predefined brush named Transparent (Brushes.Transparent) that was a SolidBrush when I looked at it in debug. I tried to use Brushes.Transparent as the brush when drawing the text, and it was successfully not showing at all. That means I get full transparency to work, but not partial transparency.

View 2 Replies

Interface And Graphics :: Clickable Transparent Area On PictureBox

Jul 25, 2011

i'm working on Virtual K770i project - there is a picture of mobile, now i want to create clickable areas on "keypad" of mobile....I'm got idea about transparent label or something but transparency dont work on any object but Form1 - so how to make transparent clickable areas on picture box (see a picture)

View 2 Replies

Interface And Graphics :: Design - Make A Form Transparent

Nov 18, 2010

i make a Form transparant where i dont want form background. So say like i got a round form and i can transparant the white background of the round even possible?

View 6 Replies

Interface And Graphics :: Transparent Background In User Control?

Dec 3, 2008

I am attempting to write a simple 11ball style game. It requires images of poolballs overlapping each other. Since the balls will need some internal intelligence I was hoping to create them as usercontrols.I am having trouble gettiing the control's background to be transparent.Setting the background color to (Web) transparent only makes the background clone the form background color.

View 1 Replies

.net - Know If PNG Has An Alpha (or If The Alpha Is Completely White)?

Jan 13, 2010

I have PNG and need to know if it has an alpha (or if the alpha is completely white)? How can I accomplish this in vb.net code.

View 1 Replies

Interface And Graphics :: VB Map Application - Enable Users To Select A Map Zone Of A City Centre?

Nov 7, 2009

I am developing an application for an emergency services organisation using VB 2008 that will enable users to select a map zone of a city centre and plot icons onto it, then save/export the layered map with icons as an image.My problem at the moment is that I am struggling developing the point where the user imports in the icon (for example, a flame icon where a fire started) and drags it around the map within the picture box to the required area.I want them to be able to select their desired icon from a series of commandbuttons and for the icon to 'appear' on the picturebox and be enabled to be dragged around and dropped as required. The organisation already has such a thing working in Microsoft Word (!) and that uses the ActiveDocument.Shape.LoadImage function on a pushbutton to import the icon and then it is placed on the map as required, but this is really unreliable for them.I dont even know if you can layer images onto an existin picturebox within an application in this way and then export as a flat image.

View 3 Replies

Interface And Graphics :: Transparent Label Text / Forecolour Defaults To Gray At Runtime

Dec 5, 2009

I'm a second year A-level student (12th Grade U.S. equivalent) studying Computing, Physics and Maths. I like anime, PC gaming, climbing and mountaineering. That's an insight to who I am. Thought I'd add it here to my first post since I couldn't spot and introductions section.

[Code]...

View 7 Replies

Using A Random To Enable Controls?

Jun 18, 2009

How would I code it so that I can use a random to add the number of the control so that a random control will be enabled. I.E. I'm trying to make a duck shooting game, random will get a random number then append that number to "picturebox" so that it becomes "picturebox36" to "picturebox70". Then I wall use that string along with ".enabled = true" in order to enable it.

So far I have this:

Public Class Form1
Dim RandomA As New Random
Dim rnd As New Integer

[Code]....

View 3 Replies

Form Transparent But Not The Controls?

Apr 5, 2010

I know Opactity controls a form's tranparency but the controls have the same level of tranparency too.

View 5 Replies

Transparent Form But Visible Controls?

Dec 21, 2009

if I set the property Opacity = 0, a form becomes transparent... but become transparent all it controls, too!how to make transparent ONLY the form and let the controls, labels, buttons etc. visible??

View 3 Replies

Form Transparent But Controls Visible?

Aug 20, 2010

When I make my form Opacity 0% everything disappears including controls that I know will happen im not dumb ok so I tried another method using Transparency Key I had success BUT my problem there is that when I have a picture box and an image IN the picture box around the image is the Form Background color so lets say I picked Maroon for Form1.BackColor, The edges of my image is Maroon

View 6 Replies

Is There Another Attribute That Controls If A Background Can Be Transparent?

Feb 16, 2010

I have made one game Tic tac toe. Where the use could place a X or a O i used a empty label with back colour "transparent" for them to click on.I have now come round to making a Connect 4 game in the exact same solution, once again i am using empty labels for the users to select which slots to place there counters. However when i select "transparent" as these labels back colour they still dont go transparent.Its now happening on all forms, all projects, is there another attribute that controls if a background can be transparent?

View 6 Replies

Make Form Transparent - But Not Controls?

Jul 10, 2010

How can I make a panel on my form not become transparent when the form is set to transparent? I have the form at 80% opacity, but I don't want the panel to be transparent.

View 6 Replies

Transparent Form But Controls Visible?

Feb 16, 2012

I am having trouble finding a way to make the form transparent but the controls still visible. The only transparency I have been able to get to work on the form is

Me.Opacity = <value between 0 and 1>

but that affects all the controls on the form Is there a way to make the controls not inherit this property from the form? Is there another way to make the form transparent? I have buttons and a checkbox that I don't want to be affected by the transparency at all, and a picturebox that I do want to be able to control the level of transparency. Currently, I'm using a slider bar, and controlling the opacity of the form, but that makes everything on the form transparent. I'd actually like for the form itself to be completely invisible, and for my slider bar to control the opacity of the picturebox only.

View 3 Replies

How To Enable Environment To Allow To View Controls On Different Tabs

May 22, 2009

I am about dead certain that in VB Express 2008 that I was able to have multiple tabs. And, on each tab I put controls. I could also click on a tab and see the controls only on that tab.I am now in Visual Studio Pro and I cannot for the life of me look at what is on a specific tab. Only the first tab wants to shows its controls.Does anyone know how to enable the environment to allow me to view the controls on different tabs?!

View 3 Replies

Preventing Controls Enable Property From Changing?

Mar 9, 2010

I m implementing control based security in my application. where i m saving controlname (per form) in database, which are to be restricted. So far I have implemented the security and restricted control get disabled.

Now what i want to do is that i have to prevent that for those controls the "control.Enable" property should not change. how can i restrict that.

I have achieved the functionality by canceling enable=true property in "Invalidated" event of the control. but this is not some generic way. I have to map this event for all controls in all forms :(.

What i really want is that as all my froms are derived from same parent which implements the security. so the parent should some how restrict enable property from changing.

So,HOW CAN I PREVENT CONTROL enable property from changing in their parent class?

View 8 Replies

2008 : Transparent Form But Visible Controls?

May 1, 2012

if I set the property Opacity = 0, a form becomes transparent... but become transparent all it controls, too!how to make transparent ONLY the form and let the controls, labels, buttons etc. visible??

View 2 Replies

PictureBox Controls In Form With Transparent Background

Dec 31, 2011

I have multiple picturebox controls in my form. Both of them contain an image with a transparent background. I want them to be on top of each other. I've already set their BackColor property to Transparent, but when I place one on top of the other one, the following happens: [URL]. How can I make them transparent while they are on top of each other?

View 4 Replies

Semi-transparent Form With Opaque Controls?

Oct 30, 2009

I have a 75% transparent form and I would like the controls and elements that I place on it to be 100% opaque. I've searched but didn't turn up any results.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved