Using the Form Scrollbar to Control Image Transparency in Excel VBA - vba

I'm struggling in making a form scrollbar to control the image transparency. To be specific, I've got two images that I'm linking to two buttons. Hide/show buttons, and I want the scrollbar to control the image transparency as shown in the image below. Your help would be appreciated. I can't wrap my head around to code it.

Here is a low-tech approach.
1) Create a rectangle and fill it with your picture. This doesn't require any VBA.
2) Insert the scrollbar and, using the properties, link your scrollbar to a cell with the default 0-100 range of the scrollbar's values. For example, in the following picture I linked it to J20:
Then, in a standard code module put:
Sub SetTransparency()
Sheets(1).Shapes("Rectangle 1").Fill.Transparency = Sheets(1).Range("J20") / 100
End Sub
(With of course things like Sheets(1), "Rectangle 1" and "J20" to be adjusted to match your situation)
Then - all you have to do is right click on the control and select Assign Macro to assign this macro to your control. It can be used like:
Possibly unfortunately (depending on your desires) the transparency doesn't change continuously as you scroll. AKAIK, you would need to use Active-X controls for that.

Related

Powerpoint VBA Positioning listview

I am trying to get 2 listview objects to work on a powerpoint slide. I can place them anywhere on the slide, but when I start the slideshow, 2 smaller copies appear in the upper-left corner. Text added to the listview appear in the upper-left boxes. I can't select the original listview either.
How can I prevent the 2 copies from showing up so I can work with the listviews I positioned on the slide?
The slide
http://prnt.sc/ectyx6
The Slideshow
http://prnt.sc/ectz8u
I looked into it a bit, and I think it's just a glitch with the Listview control.
From my tests, the actual Listview control was smaller then the original, but the top left position was correct (after the first time in reading/presentation view). I assume the they are smaller because it doesn't have a zoom property, and the slide is stretched to fit the window.
If you really want a Listview...which I hate to call into question, but think is warranted...then you can just Insert a Rectangle without a border over the Listview control to hide the original placeholder. The real Listview will still get drawn on top.
I think this is just the beginning of your troubles with a Listview control in PowerPoint...are you sure that you need it. Maybe linking to an Excel file with the Listview would be better, or some use of animation.

Modify Z-index on Series object in Excel 2010

I am using excel 2010.
I have a chart diagram on which i put a rectangle to surround the highest column bar.
In order to make things more readable, i would like to place this rectangle on the chart but NOT in front of the lines/bars/etc...It has to be behind them.
Shape objects (like my rectangle) have a ZIndex property than can be modified in order to achieve that. Thing is, it seems impossible to put that behind the elements of my chart, nor the chart itself.
The main reason is because Chart objects and Series objects (which are the columns inside my chart) doesn't have a Z-Index property.
Is there a way which could allow me to achieve this ? Other than modifying ZIndex property ?
You can move the Chart in front of the Shape, or the Shape in front of the Chart. But what you are looking to do is to stuff the Shape behind some components of the chart, but still in front of the chart background.
That, as far as I know cannot be done.
But you can simulate the effect by making the Chart's background and the Plot area transparent (no fill, instead of the default White fill) by simply right clicking and adjusting properties.
Also, you can highlight both the chart and the shape (Ctrl-Multiple Select) and lock the two together so your Shape will look like it's a part of the chart and is behind the components.
Of course, the shape will be behind the whole chart itself (by setting the appropriate Z-value, which you may find by simply clicking on Record Macro and running the formatting once to get sample code) but since the chart's background is transparent and so is the plot area's it'll look as if the rectangle's behind the lines and all.

Want To Create A Floating Speech Bubble Form

Wondering if someone could help me....
I have a small .NET application where I have an Edit button on a main form. When the user clicks the Edit button, I want to popup a small form right next to it (on top of the main form) with a speech balloon tail attached on the side of the form pointing to the Edit button. So it gives the effect of a floating form pushed out from the Edit button.
I don't want the appearance of a normal speech bubble, I want it to look like an actual borderless form (with square corners). It could be a custom control or anything (however, I am not yet familiar with creating my own custom controls), but I need to add Text Controls, Pictures, Label Controls, etc. to this floating form.
Any help would be appreciated.
Thanks
UPDATE
I am trying to create something to this affect:
So imagine the ? being the Edit button and the other being a form with custom controls.
Like this?
To get this behavior:
Select an image which will represent your speech bubble. Put a PictureBox on the form, make it use this image. Place two labels, as above, adjust the font.
Pick your transparency key (color). Your image background and form background need to be set to that. I used black for demo purposes, which is a bad choice if you plan to have any black or text in your speech bubble. Set form's TransparencyKey property to this color in designer. More about TransparencyKey on MSDN.
(final step, not shown on the screenshot). Set FormBorderStyle = None.
Also make sure you have other ways to close your bubble, because X will be unavailable.
The final result may look something like the following:
Note: You may notice some drawing artifacts, most images on the internet have smooth borders, and transparency key does not support shades, has to be exact color. If you are fine with these minor artifacts, feel free to leave it at that. Or, edit it to get rough borders. Or find another one that better suits your needs.

Draw border around controls on VBA Userform without using a Frame?

I am designing a VBA UserForm (in Excel, if it is relevant) and I would like some controls to be visually grouped together.. but when I put them in a frame, I am getting some undesired results (part of it has to do with the RefEdit control which seems to be particularly unhappy inside a frame).
Is there a way to draw a border around a group of controls on a form without putting them inside a Frame?
Use a label with the caption deleted and the border style set to fmBorderStyleSingle. It may appear on top of your other controls, so right click on it and select "send backwards" until it's behind your other controls.
The best way to do this would be to create the shape over where you need it to be. Drag highlight everything that you want on top of it, then right click and brink it all forwards. Then when you drag your shape back over the top it will in fact be underneath everthing else.
Hope that helps.
This worked for me and I was at first having the same issue where I had to choose to "Send Backward" up to 30 times per label in some cases. I found that hitting the Ctrl-K sends it to the back of all controls with one time hitting these keys.

In VB.NET, can we draw empty lines instead of blank area in non existent row of datagrid?

EDITED:
I think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. :)
Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel.
Can we achieve this using VB.NET design time property?
And also, we must not trigger the display of vertical scrollbar this way.. :)
Thanks
You might try doing a screen capture of the dgv when it is full of blank lines and use that as your background. However, you'll have a problem with the vertical lines if they resize the columns. In your picture you don't have any vertical lines so if you don't need them then just erase them and your problem is solved.
There's also the option of using the Virtual Mode. When you set that property to true then you can set the number of visible rows, but you are responsible for telling the dgv what each individual cell is supposed to contain: http://msdn.microsoft.com/en-us/library/2b177d6d.aspx
Or you can just add extra blank rows to whatever datasource you are setting your DGV to.
Use the ScrollBars property to turn the vertical scroll bar off.