Solved

mdiform interface

Posted on 2000-02-23
8
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

690 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