I noticed in the properties of the designer you can center the text in a label, etc. did not see anything that allows you to center the view itself.
For example, I looked at the properties for a button. There is Horizontal Alignment and Vertical Alignment for Text Style but I don't see anything like that for Button Properties.
Is there a way to control the button alignment?
Thanks.
You will need to do it programmatically:
Sub CenterView(v As View, parent As View)
v.Left = parent.Width / 2 - v.Width / 2
v.Top = parent.Height / 2 - v.Height / 2
End Sub
For example:
CenterView(button1, Activity)
If you do have access to the .xml files ( I'm no basic4android expert ),
you can look into the properies layout_gravity and gravity,
depending on how you want to center.
Good luck!
/RandomSort
Related
I'm using the code:
Label1.Left = (Me.ClientSize.Width / 2) - (Label1.Width / 2)
to center the label, but it seems to hide behind panel1 when I center it, it does not disappear behind it when not centering it.
I have right-clicked the panel and sent to back but that doesn't seem to do anything.
Thanks
Use Anchor property for centering the label.
In designer:
Remove all anchors, by default Top and Left anchors are enabled
In code:
Label1.Anchor = AnchorStyles.None
Enabled anchors keep selected distance to the parent boundaries same when parent size is changed.
When opposite anchors are disabled distance to parent's corresponding boundaries will be kept even.
I used the awesome tutorial at http://www.codeproject.com/Articles/44235/Painting-Vista-s-Aero-NonClientArea-in-VB-NET to make my form have custom non-client area controls. It now looks like so:
http://i.imgur.com/5A1GtF7.jpg
I would like to make it so that the non-client area extends all the way down to the TabControl page start, so the logo is completely in the non-client area and there is no grey at the top of the window.
Find this line in the form's code:
dwmMargins.cyTopHeight = nccsp.rect2.Top - nccsp.rect1.Top
Now just add however many pixels you need:
dwmMargins.cyTopHeight = nccsp.rect2.Top - nccsp.rect1.Top + x
Since you can use DLL's, I found this:
Download this DLL: http://www.mediafire.com/download/jmvjiu2wty4/rtaGlassEffectsLib.dll
Then create an instance of rtaGlassEffect
Dim glass As New rtaGlassEffectsLib.rtaGlassEffect
Finally put this in your form's Load event handler:
glass.TopBarSize = yourSize
glass.ShowEffect(Me)
I've created some animated as well as static banners in Flash CS5 and I'd like to apply clickTag ActionScript 2.0 code to them. However, I only found tutorials where over all the existing layers, you create a rectangle using the Rectangle Primitive Tool, set the border, fill, and opacity to 0 and then apply the code and export the movie. When I create the rectangle, there is no setting for opacity, and when I set no border and no fill, the rectangle disappears and the dark dot in the timeline becomes empty so I can't click on the rectangle in order to convert it into a symbol.
I would really appreciate any advice on this!
Create your rectangle using 'Rectangle Primitive' tool shapes menu instead of the regular Rectangle tool.
select your rectangle by a single click.
From the properties panel select the bucket symbol (the one used to control the fill color) and you will find a setting 'alpha' for setting the transparency.
change the alpha value to 0. after that remove the stroke.
select your rectangle, from the top menu : Modify > Convert to symbol. give it a name and select 'button' from the dropdown. press ok.
now select the button you just created, open the actions panel and paste the following code :
on (release) {
if (clickTAG.substr(0, 5) == "http:")
{
getURL(clickTAG, "_blank");
}
}
I have a simple form in Access 2003. The form has a List control and a button. I wanted to make the list to resize with the form (only vertically) while the button remains at the bottom right of the List. I'm using the following code on the form's resize event.
list.Height = Me.InsideHeight - list.Top - 200
commandButton.Top = list.Height + list.Top + 50
This works fine as I resize the form, until the form height gets to a certain height. Then I get this error;
Run-time error '2100':
The control or subform control is too large for this location
This error is occurring at the line where I'm assigning the commandButton.Top. If I remove this line then the list height changes fine. I don't have any subforms in the form.
Does anyone know why this is happening?
Thanks
I think it is because you need to resize the detail section of the form first.
Try changing the code to
Me.Section(0).Height = Me.InsideHeight
list.Height = Me.InsideHeight - list.Top - 200
commandButton.Top = list.Height + list.Top + 50
Came by here (as many have) with the same problem and then realised my issue. Be mindful when resizing a control to a larger size with regard to the order of setting properties.
I would recommend setting the TOP and LEFT positions before HEIGHT and WIDTH.
Although my final sized control should have fitted OK once resized, I had originally tried setting the WIDTH first which attempted to enlarge the control exceeding the width of the form. My application threw the 2100 error at that point. I really hope this helps someone! Also, don't forget to set dimensions in TWIPS which is set as INCHESS x 1440 (or CM x 566.9291), ie: .Width = 10 * 566.9291 to set a control width to 10cm.
I get this same error if I set the width to greater the 31680.
With a little more research, I notice MS Access only allows a form width to be 22" wide. 22" = 31680 TWIPS.
So my workaround solutions it to add a check:
If newWidth > 31680 Then newWidth = 31680
I have a PictureBox that is docked in the upper left corner of a form. It is contained inside of a SplitContainer, and the PictureBox is set to Fill the side of the panel that it resides:
SplitContainer:
___________________
| _________ >
| | | >
| | LogoBox | >
| |_________| >
|___________________>
I have the SizeMode set to Zoom so that the image will be resized to fit the bounds of the PictureBox. By default, the image is centered with this SizeMode. I am wondering if it is possible to force the image to be left-aligned instead of centered.
Thanks in advance!
It seems to me that Zoom is always going to align the left and right sides with its container. I would suggest trying one of these workarounds:
Create another panel within the left panel of your existing SplitContainer. The new one would be transparent an essentially used as a spacer. As long as this is at the lowest z-level (sent to back) this should not interfere with your other controls.
Add a percentage of transparent pixels to the right of your image in your image editor relative to how much spacing you need after the zoom is done. In this case you would need to make sure you have the correct image format.