Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.07.28;
Скачать: CL | DM;

Вниз

Как сделать прям-к для выделения части картинки, чтобы она не...   Найти похожие ветки 

 
Hatawa   (2003-07-14 18:41) [40]

Лови!


 
Hatawa   (2003-07-14 19:13) [41]

Поймал???


 
Fenik ©   (2003-07-14 19:29) [42]

Мне бы ваши проблемы..


 
Hatawa   (2003-07-14 19:32) [43]

2Fenik:

а у тебя что??


 
Fenik ©   (2003-07-14 21:28) [44]

У меня сегодня кошка родила вчера котят.

unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
ScrollBox1: TScrollBox;
OpenDialog1: TOpenDialog;
PaintBox1: TPaintBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
private
FDown: Boolean;
fx, fy, oldx, oldy: Integer;
FBitmap: TBitmap;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then begin
FBitmap.LoadFromFile(Opendialog1.FileName);
PaintBox1.Width := FBitmap.Width;
PaintBox1.Height := FBitmap.Height;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
FBitmap := TBitmap.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
FBitmap.Free;
end;

procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
PaintBox1.Canvas.Draw(0, 0, FBitmap);
end;

procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
fx := x;
fy := y;
oldx := x;
oldy := y;
FDown := True;
with PaintBox1.Canvas do begin
Pen.Color := clBlue;
Pen.Style := psDot;
Pen.Mode := pmNotXor;
Brush.Style := bsClear;
end;
end;

procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if FDown then begin
PaintBox1.Canvas.Rectangle(fx, fy, oldx, oldy);
PaintBox1.Canvas.Rectangle(fx, fy, x, y);
oldx := x;
oldy := y;
end;
end;

procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FDown := False;
end;

end.



dfm:

object Form1: TForm1
Left = 177
Top = 107
Width = 696
Height = 480
Caption = "Open"
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = "MS Sans Serif"
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 20
Top = 12
Width = 75
Height = 25
Caption = "Button1"
TabOrder = 0
OnClick = Button1Click
end
object ScrollBox1: TScrollBox
Left = 0
Top = 56
Width = 688
Height = 397
Align = alBottom
TabOrder = 1
object PaintBox1: TPaintBox
Left = 0
Top = 0
Width = 105
Height = 105
OnMouseDown = PaintBox1MouseDown
OnMouseMove = PaintBox1MouseMove
OnMouseUp = PaintBox1MouseUp
OnPaint = PaintBox1Paint
end
end
object OpenDialog1: TOpenDialog
Filter = "Bitmap|*.bmp"
Left = 108
Top = 12
end
end



Страницы: 1 2 вся ветка

Текущий архив: 2003.07.28;
Скачать: CL | DM;

Наверх




Память: 0.54 MB
Время: 0.011 c
14-91882
Домарощинер
2003-07-10 12:50
2003.07.28
Сабж


8-91778
БРУТЪ
2003-04-02 16:43
2003.07.28
Трехмерная система координат.


14-91810
TiRAN
2003-07-12 14:57
2003.07.28
Как с помощью Delphi послать файл по e-mail?


6-91790
Siemens
2003-05-22 13:12
2003.07.28
Как использовать МОДЕМ или Локалку


7-91925
slex
2003-05-19 14:40
2003.07.28
Поиск имён классов