Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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
    Richard

  2. #2
    New Lounger
    Join Date
    Mar 2002
    Location
    Redmond, Washington, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Building NON Square Forms (Access 2000)

    Hi Richard,

    The Access Web has an example of creating irregular shaped forms in Access. It

  3. #3
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Building NON Square Forms (Access 2000)

    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.
    Attached Images Attached Images

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Building NON Square Forms (Access 2000)

    <P ID="edit" class=small>(Edited by WendellB on 31-Jan-03 07:03. adding comment to indicate that my original post was somewhat misleading.)</P>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.
    <font color=blue><small>
    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. <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •