Solved

mdiform interface

Posted on 2000-02-23
8
317 Views
Last Modified: 2010-05-02
I have a picture and I want this picture to be mdiform background like monitor wallpaper (display title or center). how can I do it?
0
Comment
Question by:firza
  • 6
  • 2
8 Comments
 

Author Comment

by:firza
ID: 2549669
Adjusted points to 200
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549736
This code ought to work... see www.mvps.org/vbnet for other useful stuff

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2000 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' You are free to use this code within your own applications,
' but you are expressly forbidden from selling or otherwise
' distributing this source code without prior written consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub Form_Paint()

    Dim X As Integer, Y As Integer
    Dim ImgWidth As Integer
    Dim ImgHeight As Integer
    Dim FrmWidth As Integer
    Dim FrmHeight As Integer

   'use Image1 or Picture1, as appropriate.
   'use one of the following PaintPicture methods:
    ImgWidth = Image1.Width
    ImgHeight = Image1.Height
    FrmWidth = Form1.Width
    FrmHeight = Form1.Height
   
   'tile entire form (Method 1)
    For X = 0 To FrmWidth Step ImgWidth
       For Y = 0 To FrmHeight Step ImgHeight
          PaintPicture Image1, X, Y      
       Next Y
    Next X

   'tile left side (Method 2)
   'For Y = 0 To FrmHeight Step ImgHeight
   '   PaintPicture Image1, 0, Y
   'Next Y
   
End Sub
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549745
To centre... replace the for..next loop with

paintpicture image1, frmwidth-imgwidth, frmheight-imgheight
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549773
Sorry.. code above wont work with MDI Parent...

I did have some code somewhere to do it... I'll post if I can find it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Accepted Solution

by:
paulstamp earned 200 total points
ID: 2549801
Actually... you can use the code I listed above to achieve what you want.

Create two forms... an MDI parent and a normal form. Add two picture boxes on the normal form and set their visible prop to false. Call 1 picSource and the other picTarget and put the bitmap you want to use in the picTarget.

Then place a button on the form and use the following code in its click event.

   Dim X As Integer, Y As Integer
    Dim ImgWidth As Integer
    Dim ImgHeight As Integer
    Dim FrmWidth As Integer
    Dim FrmHeight As Integer
   
    picTarget.Width = MDIForm1.ScaleWidth
    picTarget.Height = MDIForm1.ScaleHeight



   'use Image1 or picTarget, as appropriate.
   'use one of the following PaintPicture methods:
    ImgWidth = picSource.Width
    ImgHeight = picSource.Height
    FrmWidth = picTarget.Width
    FrmHeight = picTarget.Height
     
    For X = 0 To FrmWidth Step ImgWidth
       For Y = 0 To FrmHeight Step ImgHeight
          picTarget.PaintPicture picSource.Picture, X, Y
       Next Y
    Next X

    Set MDIForm1.Picture = picTarget.Image
    MDIForm1.Show

That ought to do the trick.
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2549803
Spot the delibrate mistake - you should put the source image in picSource, not picTarget !
0
 

Author Comment

by:firza
ID: 2553039
i use MDI Perent
so what height scale use for MDIForm1.Picture use?

i don't want a normal form appear at MDI Perent? when I put the source image in picSource not picture in MDIPerent


coding your give not answering my question.


0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2553481
Leave the scalemode of the MDI parent and the picture boxes as Twips.

Instead of using another normal form you could place both the picture box es directly onto the MDI parent and resize the target to fill the entire client area.This way you dont need another form, and also you dont need to copy the picture from a picture box onto the form's picture property either.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 47
Copy a row 12 58
SQL VB connection works in one PC and doesn't in another 15 58
Problem to With line 4 42
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now