• Building NON Square Forms (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Building NON Square Forms (Access 2000)

    Author
    Topic
    #382614

    Is there a way using Access to create forms that are not the basic four sided “square”?

    Thanks
    Richard
    raheron@hotmail.com

    Viewing 2 reply threads
    Author
    Replies
    • #649451

      Hi Richard,

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

    • #649515

      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.

    • #649297

      (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. blush

    Viewing 2 reply threads
    Reply To: Building NON Square Forms (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: