Search results for 'LoadFromFile'. 2 post(s) found.
- 2009/09/03 To load image from file
- 2007/09/11 Paint a Form with a tiled bitmap image
In order to load image from file in C#, you can load them as following way. The image type could be Jpeg, GIF, Bitmap(BMP), as well as PNG.
Image m_source = Image.FromFile( 'the file name you need to load');
Isn't it simple ?
Another posts included in "C#"
| How to convert bitmap image to jpeg image ? (0) | 2009/09/03 |
| How to display message box in C# (0) | 2009/09/03 |
| How to resize and save PNG or Jpeg Image file ? (0) | 2009/09/03 |
| Finding process name on OS (0) | 2008/09/22 |
| Convert System.DateTime to UNIX timestamp (0) | 2008/09/22 |
| Retrieve system information (0) | 2008/09/22 |
| How to rename(change file name) in C# ? (1) | 2008/03/12 |
| Find Files in certain directory (0) | 2008/02/25 |
Trackback : Cannot send a trackbact to this post.
Here's how to draw tiled bitmap image on a Form:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject) ;
procedure FormPaint(Sender: TObject) ;
procedure FormClose(Sender: TObject;
var Action: TCloseAction) ;
private
public
end;
var
Form1: TForm1;
Bitmap: TBitmap;
...
procedure TForm1.FormCreate(Sender: TObject) ;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('C:\WINDOWS\cars.BMP') ;
end;
procedure TForm1.FormClose
(Sender: TObject; var Action: TCloseAction) ;
begin
Bitmap.Free;
end;
procedure TForm1.FormPaint(Sender: TObject) ;
var
X, Y, W, H: LongInt;
begin
with Bitmap do begin
W := Width;
H := Height;
end;
Y := 0;
while Y < Height do begin
X := 0;
while X < Width do begin
Canvas.Draw(X, Y, Bitmap) ;
Inc(X, W) ;
end;
Inc(Y, H) ;
end;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject) ;
procedure FormPaint(Sender: TObject) ;
procedure FormClose(Sender: TObject;
var Action: TCloseAction) ;
private
public
end;
var
Form1: TForm1;
Bitmap: TBitmap;
...
procedure TForm1.FormCreate(Sender: TObject) ;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('C:\WINDOWS\cars.BMP') ;
end;
procedure TForm1.FormClose
(Sender: TObject; var Action: TCloseAction) ;
begin
Bitmap.Free;
end;
procedure TForm1.FormPaint(Sender: TObject) ;
var
X, Y, W, H: LongInt;
begin
with Bitmap do begin
W := Width;
H := Height;
end;
Y := 0;
while Y < Height do begin
X := 0;
while X < Width do begin
Canvas.Draw(X, Y, Bitmap) ;
Inc(X, W) ;
end;
Inc(Y, H) ;
end;
end;
Another posts included in "Delphi"
| Rotating Text (0) | 2007/09/11 |
| Show *any* graphics as Glyph on a SpeedButton (0) | 2007/09/11 |
| TColor to HTML color (0) | 2007/09/11 |
| Is Point in Polygon? (0) | 2007/09/11 |
| Implementing a lasso drawing technique (0) | 2007/09/11 |
| Grayscaling a bitmap ? (0) | 2007/09/11 |
| Get Cursor Image (draw it on a Canvas) (0) | 2007/09/11 |
| How to convert HIcon to TIcon ? (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:23
moneyideas
-
Subject different money making ideas
2010/01/29 08:37
moneyideas
-
Subject different money making ideas
2010/01/31 16:39
moneyideas

Prev

Rss Feed