mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
added example for loading a picture from file
git-svn-id: trunk@5784 -
This commit is contained in:
parent
2e684b3847
commit
9ed2e1f1a3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -434,6 +434,7 @@ examples/listview/testform.lfm svneol=native#text/plain
|
||||
examples/listview/testform.lrs svneol=native#text/pascal
|
||||
examples/listview/testform.pp svneol=native#text/pascal
|
||||
examples/listviewtest.pp svneol=native#text/pascal
|
||||
examples/loadpicture.pas svneol=native#text/pascal
|
||||
examples/memotest.pp svneol=native#text/pascal
|
||||
examples/messagedialogs.pp svneol=native#text/pascal
|
||||
examples/notebk.pp svneol=native#text/pascal
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/07/25]
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/08/08]
|
||||
#
|
||||
default: all
|
||||
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom morphos
|
||||
@ -222,8 +222,8 @@ LCL_PLATFORM=gtk
|
||||
endif
|
||||
export LCL_PLATFORM
|
||||
endif
|
||||
override TARGET_UNITS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar edittest memotest groupbox speedtest toolbar messagedialogs notebooktest listviewtest synedit1 groupboxnested testall
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) trackbar toolbar testall speedtest scrollbar progressbar notebooktest notebk messagedialogs memotest listviewtest listboxtest hello groupbox edittest comdialogs combobox checkbox bitbutton synedit1 groupboxnested
|
||||
override TARGET_UNITS+=hello bitbutton checkbox combobox comdialogs edittest groupbox groupboxnested listboxtest listviewtest loadpicture memotest messagedialogs notebk notebooktest progressbar scrollbar speedtest synedit1 testall toolbar trackbar
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) hello bitbutton checkbox combobox comdialogs edittest groupbox groupboxnested listboxtest listviewtest loadpicture memotest messagedialogs notebk notebooktest progressbar scrollbar speedtest synedit1 testall toolbar trackbar
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
override COMPILER_UNITDIR+=../lcl/units/$(CPU_TARGET)/$(OS_TARGET) ../lcl/units/$(CPU_TARGET)/$(OS_TARGET)/$(LCL_PLATFORM) ../components/units/$(CPU_TARGET)/$(OS_TARGET) .. .
|
||||
ifdef REQUIRE_UNITSDIR
|
||||
|
@ -7,19 +7,56 @@ name=lazarus-examples
|
||||
version=0.9b
|
||||
|
||||
[target]
|
||||
units=hello notebk comdialogs progressbar trackbar listboxtest \
|
||||
bitbutton combobox checkbox scrollbar edittest memotest \
|
||||
groupbox speedtest toolbar messagedialogs notebooktest \
|
||||
listviewtest synedit1 groupboxnested testall
|
||||
units=hello \
|
||||
bitbutton \
|
||||
checkbox \
|
||||
combobox \
|
||||
comdialogs \
|
||||
edittest \
|
||||
groupbox \
|
||||
groupboxnested \
|
||||
listboxtest \
|
||||
listviewtest \
|
||||
loadpicture \
|
||||
memotest \
|
||||
messagedialogs \
|
||||
notebk \
|
||||
notebooktest \
|
||||
progressbar \
|
||||
scrollbar \
|
||||
speedtest \
|
||||
synedit1 \
|
||||
testall \
|
||||
toolbar \
|
||||
trackbar
|
||||
|
||||
[require]
|
||||
packages=fcl regexpr
|
||||
|
||||
[clean]
|
||||
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) \
|
||||
trackbar toolbar testall speedtest scrollbar progressbar notebooktest \
|
||||
notebk messagedialogs memotest listviewtest listboxtest hello groupbox \
|
||||
edittest comdialogs combobox checkbox bitbutton synedit1 groupboxnested
|
||||
hello \
|
||||
bitbutton \
|
||||
checkbox \
|
||||
combobox \
|
||||
comdialogs \
|
||||
edittest \
|
||||
groupbox \
|
||||
groupboxnested \
|
||||
listboxtest \
|
||||
listviewtest \
|
||||
loadpicture \
|
||||
memotest \
|
||||
messagedialogs \
|
||||
notebk \
|
||||
notebooktest \
|
||||
progressbar \
|
||||
scrollbar \
|
||||
speedtest \
|
||||
synedit1 \
|
||||
testall \
|
||||
toolbar \
|
||||
trackbar
|
||||
|
||||
[default]
|
||||
|
||||
|
67
examples/loadpicture.pas
Normal file
67
examples/loadpicture.pas
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
program LoadPicture;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces,
|
||||
Classes, SysUtils, Forms, Controls, Graphics, ExtCtrls;
|
||||
|
||||
type
|
||||
TLoadBitmapForm = class(TForm)
|
||||
Image1: TImage;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
{ TLoadBitmapForm }
|
||||
|
||||
constructor TLoadBitmapForm.Create(TheOwner: TComponent);
|
||||
var
|
||||
Filename: String;
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
||||
Filename:=SetDirSeparators('../images/splash_logo.xpm');
|
||||
|
||||
Caption := 'Example: Loading picture from file';
|
||||
Width := 429;
|
||||
Height := 341;
|
||||
Position:= poScreenCenter;
|
||||
|
||||
Image1:=TImage.Create(Self);
|
||||
with Image1 do begin
|
||||
Name:='Image1';
|
||||
Parent:=Self;
|
||||
Align:=alClient;
|
||||
Picture.LoadFromFile(Filename);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
LoadBitmapForm: TLoadBitmapForm;
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TLoadBitmapForm,LoadBitmapForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user