Is there a way using Access to create forms that are not the basic four sided “square”?
Thanks
Richard
raheron@hotmail.com
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Building NON Square Forms (Access 2000)
Is there a way using Access to create forms that are not the basic four sided “square”?
Thanks
Richard
raheron@hotmail.com
Absolutely. Here’s some code:
Private Declare Function CreateRoundRectRgn Lib “gdi32” (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib “user32” (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib “gdi32” (ByVal hObject As Long) As Long
Dim intFrameWidth As Long
Dim intFrameHeight As Long
Dim intEllipseSize As Long
Dim intBorderSize As Long
Private Function SetFormRegion() As Long
Dim intInsetFrame As Long
intInsetFrame = CreateRoundRectRgn(intBorderSize, intBorderSize, intFrameWidth – intBorderSize, intFrameHeight – intBorderSize, intEllipseSize, intEllipseSize)
SetMiniCalendarRegion = intInsetFrame
End Function
Private Function ShapeForm()
Dim x As Long
Dim dwReturn As Long
x = SetMiniCalendarRegion
SetMainWindowRegion x
DeleteObject x
DeleteObject dwReturn
End Function
Okay, to use this, you’ll need to set the intFrameWidth, intFrameHeight, intEllipseSize and intBordersize. The reason I have those variables in place, is because the form I have ‘shaped’ by this code, is actually getting the upper left corner of the form. The ‘frame’ variables represent the size of the section I want displayed. The Border variable determines how far form the top and left I want to be moved in. That let’s me ‘hide’ the control box, while still having it there (because you can use the Send Message API to allow the form to be movable still). The last variable is the intEllipseSize. That tells the API how ’rounded’ you want the corners.
This code is straight out of a Beta Release of my MiniCalendar that I sent out tonight. It’s seperated like it is to accomodate that form. (It has expanding menus, that expand from the form, which is not actually ‘expanding’ the form, but instead is coming out as a small square ‘attached’ to the form. I’d post it here, but it’s about 200k zipped (I have some images on it). If you want to become a beta tester, let me know, and I’ll send it to you.
The API I used here just gives you rounded forms. You can get as fancy as you want. There are several ‘region’ API’s. For instance, there is a region API that let’s you build a region based on the shape of a bitmap. You can also create ‘seperate’ regions (there are simple api’s for rectangle and elliptical ‘regions’), then combine the regions. The combining can overlap two regions, showing the combined area, the unmatched area, or only the matched area. (Actually there are 5 options I think).
I hope this gives you something to point you in the direction you want.
WARNING….Window API’s can get tricky, I highly suggest you do a little research to understand exactly how windows work within Windows. It get’s tricky sometimes, especially with Access. (Access forms are a pain in my behind, because they don’t work like normal window forms. In a VB form, or a dialog box, each control has an hWnd, because they represent a window of their own. Access actually creates a ‘window’ for the active control, everything else appears to actually be ‘painted’ onto the form’s window.).
I am attaching a screen shot of my ‘MiniCalendar’ (Well, a new version that’s in beta testing right now….). It has it’s about menu expanded.
(Edited by WendellB on 31-Jan-03 07:03. adding comment to indicate that my original post was somewhat misleading.)
Not that I know of – in fact I can’t think of any Office application (including Visio whether it’s really a part of Office or not). Even in Visual Basic it’s a fairly complicated challenge.
Well, as Kevin and Drew point out, it is possible. It just depends on how comfortable you are with using API calls and other such things. I should have been more explicit in my comment and referenced “standard development tools” or something like that.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.