设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 3519|回复: 4
打印 上一主题 下一主题

Assigning Auto Keys for Aligning Controls

[复制链接]
跳转到指定楼层
1#
发表于 2005-8-29 02:24:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
标题:Assigning Auto Keys for Aligning Controls

来源:http://allenbrowne.com/casu-05.html

If you have used the Wizards to create forms and reports, you will have also tried dragging controls to a new location in Design View. Moving PostalCode beside Town makes sense, especially if all controls don't fit on screen. You've probably figured out how to move a control separately from its label (larger black square at top left when the control is selected), how to select multiple controls (hold down Shift), and how to make a control just the right size ("Fit to Size" from the Format menu).

Getting controls to align correctly after dragging them around can be a chore! "Snap to grid" is useful, but often doesn't give the precise placement you want.. Too often you find yourself roughly aligning the controls and then going to the Format menu (Layout in Access 1) to get Align, Left for text boxes and Align, Right for labels. Then you select the ones on the same row and go back to the menu for Align, Top or Align, Bottom.

A keystroke such as Ctrl+L for align left or Ctrl+R for align right could speed things up. Here are the steps to get that result.

Create a new macro and save it with the name AutoKeys. (The name is important.)

If you cannot see a column called "Macro Name", check Macro Names on the View menu.

In the first row of the Macro Name column, enter ^L i.e. a caret (above the 6 at the top of the keyboard) and an L. Access interprets the caret as referring to the Ctrl key.

In the Action column beside this, choose RunCommand.* Then in the lower pane, choose the command AlignLeft.

In the second row, enter ^R under Macro Name, and RunCommand under Action. In the lower pane, choose AlignRight.

Enter another two rows using ^T for AlignTop, and ^B for AlignBottom.

Save the macro, and test it. Select two or three controls that are not aligned correctly, press Ctrl and L together, and watch them move into place.





* Access 2: Choose DoMenuItem as the action, and in the lower pane, Form Design, Format, Align, Left.

* Access 1: Choose DoMenuItem as the action, and in the lower pane, Form Design, Layout, Align, Left.

There will probably be other operations to add to this macro to cover your needs. Try to avoid reassigning standard Windows keystrokes such as Ctrl+C and Ctrl+V (copy and paste).









By the way, did you know that an ampersand (&) can give you a keyboard shortcut to a control? For example, type &Animals as the caption for a button and Access underlines the "A" indicating that you can move the focus to that button with Alt+A.

译文:为控件对齐指定一个快捷键





如果你使用过向导建立过窗体或报表,你将还需要通过在设计模式中拖动控件到一个新的特定区域。移动邮政编码到旁边的市镇做出判断,特别是在所有的控件都不合适屏幕时。你很可能会发现怎样去移动个别窗体的标题控件(当控件别选中在顶部的左方有一大块黑色的地方),怎样选择多个控件(使用SHIFT键),和怎样去调整一个控件的大小(适合的菜单大小规格)。





获得控件使其正确的排列成一行以后拖动他们围绕成一区域。“对齐网格”是非常有用的,但是一般不需要精确的放置你想要的。通常你认为自己大概的对齐控件然后去到格式菜单使其对齐成一行,左边为文本框,右边为标签。然后选择一个一个的放在同一排,回到菜单栏使其顶部,底部对齐。





击键像“CTRL+L”为左边对齐或者“CTRL+R”对齐右边能够大大的提高速度。这里给出获得这样结果的步骤:





1.       建立一个新的宏,然后保存名字为:Auto Keys。(这个名字非常重要)





2.       如果你不能够看到宏名称栏,检查宏名称在视图模式。





3.       在宏名称栏的第一行,输入^Li.e,一个字符(在键盘的6字上面)然后加一个L。ACCESS会认为是字符提及到CTRL键。





4.   

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2005-11-1 19:40:00 | 只看该作者
看不懂
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-21 18:38 , Processed in 0.101354 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表