Solved

Image on MDI parent form

Posted on 2000-04-19
2
296 Views
Last Modified: 2010-04-04
I wanted do display Logo on center of MDI parent form, but when I start app, image is not visible on form. How to solve that?
0
Comment
Question by:siki
[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
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2732696
hi,
this is a quite well known problem ,try
drop a TImage( with logo added ) on your mdi forms parent form and try this method to overcome the problem:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
   FClientInstance,
   FPrevClientProc : TFarProc;
  Procedure ClientWndProc(VAR Message: TMessage);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
PROCEDURE TForm1.ClientWndProc(VAR Message: TMessage);
VAR
  MyDC : hDC;
  Ro, Co : Word;
begin
  with Message do
case Msg of
 WM_ERASEBKGND:
   begin
    MyDC := TWMEraseBkGnd(Message).DC;
    FOR Ro := 0 TO ClientHeight DIV Image1.Picture.Height DO
    FOR Co := 0 TO ClientWIDTH DIV Image1.Picture.Width DO
    BitBlt(MyDC, Co*Image1.Picture.Width,Ro*Image1.Picture.Height,
    Image1.Picture.Width, Image1.Picture.Height,
    Image1.Picture.Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
    Result := 1;
   end;
    else
     Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam, lParam);
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 FClientInstance := MakeObjectInstance(ClientWndProc);
 FPrevClientProc := Pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
 SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 SetWindowLong( ClientHandle, GWL_WNDPROC, longint(FPrevClientProc));
 FreeObjectInstance( FClientInstance);
end;

end.
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2733180
var
  Bitmap:TBitmap;

procedure TMainForm.FormCreate(Sender: TObject);
begin
  Bitmap:=TBitmap.Create;
  Bitmap.LoadFromFile('c:\Yield.bmp');
  Self.Brush.Bitmap:=Bitmap;
end;

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if Assigned(Bitmap) then FreeAndNil(Bitmap);
end;
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DBGrid or StringGrid ? 6 137
RESTRequest Parameter 4 85
Firemonkey allowing RTL on android 6 79
Using MMsystem To change audio input 1 40
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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