[AccessD] MS Access Drawing Capabilities Part I

Mark A Matte markamatte at hotmail.com
Thu Nov 20 08:10:02 CST 2008


I tried sending this yesterday...but the message was too long...lets try again!!!
...and again...I'll leave my other posts at the bottom in case they are relecant.  I'll send in 2 parts********** Paul, I don't  have the code available for the "do stuff when you click"...easy enough by calling the same function from every object(event of your choice)...that parses the object name...and displays what you need.  Here is the code that fires when my form opens...it paints the form and organizes all the objects on the form.  Below that is the code from the other form I use to move the objects around.  Keep in mind...the moving/organizing of the objects is all table driven(left,top,height, width all stored in a single  record for each object).  It's barely clear to me...so let me know if you have questions. Thanks, MarkA. Matte  Function PaintForm()    Dim strSQL As String    Dim strControlName As String    Dim cntl As Control    Dim ret    Dim MyRst As Recordset    Set db = CurrentDb()    Set MyRst = db.OpenRecordset("tblDesign", DB_OPEN_DYNASET)            strSQL = "[Active] > -2"    MyRst.FindFirst strSQL    Do Until MyRst.NoMatch        strControlName = MyRst!ControlNumber        Set cntl = Forms!frmtables(strControlName)        cntl.Top = MyRst![Top]        cntl.Left = MyRst![Left]        cntl.Visible = False        If MyRst!Active = False Then GoTo Skip        Select Case Left(MyRst!ControlNumber, 6)            Case "pool_p"                cntl.Visible = True                If MyRst!Type = "V" Then                    cntl.Width = 586                    cntl.Height = 1020                    cntl.Picture = "C:\Documents and Settings\Mark\Desktop\Pool\PTable2.gif"                Else                    cntl.Width = 1035                    cntl.Height = 600                    cntl.Picture = "C:\Documents and Settings\Mark\Desktop\Pool\PTable3.gif"                End If                            Case "labelp"                cntl.Visible = True                If MyRst!Type = "V" Then                    cntl.Width = 540                    cntl.Height = 1020                    cntl.TopMargin = 216                Else                    cntl.Width = 1020                    cntl.Height = 600                    cntl.TopMargin = 0                End If                        Case "countp"                cntl.Visible = True                If MyRst!Type = "V" Then                    cntl.Width = 420                    cntl.Height = 600                    cntl.TopMargin = 43                Else                    cntl.Width = 420                    cntl.Height = 600                    cntl.TopMargin = 144                End If            Case "bar__b"                cntl.Visible = True                cntl.Height = MyRst![Height]                cntl.Width = MyRst![Width]            Case "dine_d"                cntl.Visible = True            Case "labeld"                cntl.Visible = True            Case "stools"                cntl.Visible = True            Case "labels"                cntl.Visible = True                            End SelectSkip:        Set cntl = Forms!frmtables(strControlName)        MyRst.FindNext strSQL    LoopEnd Function > I left 1 piece of info out...I wanted the same type of events to fire for> each object type...so I wrote some code that used the name of each object to> determine what function to call...and used a naming convention religiously.> When a certain object was clicked...the border(a label) would change> color...and a lookup would count and display on on the object how many> records were associated with the table. So for each object I had 3> things.Example:> > Text box---tbPool01> Label---lbPool01> Image---imPool01> > Text box---tbBoot01> Label---lbBoot01> Image---imBoot01> > So when you clicked on an object(image) it would pass its name to the> function...parse the name...then depending on what 'kind' it was> ('boot','pool','stoo'' etc)...Mid([MyName],3,4)...would do specific things> to that images corresponding text box and lable.> > Using this type of naming...allowed me to store the names and positions of> all objects in a table, loop through all items when the form opened and> positioning them according to the data in the table....giving the user a way> to move items around(UP,DOWN,RIGHT,LEFT buttons adding and subtracting> TWIPS) on the screen and basically customizing it for their use.(even worked> in an MDE).> > Good Luck,> > Mark A. Matte
_________________________________________________________________
Windows Live Hotmail now works up to 70% faster.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008


More information about the AccessD mailing list