Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2003.07.28;
Скачать: [xml.tar.bz2];

Вниз

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

 
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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.53 MB
Время: 0.008 c
3-91639
Devil
2003-07-03 22:27
2003.07.28
Обмен


14-91808
AlexGreG
2003-07-09 05:48
2003.07.28
... Ох уж эти программисты ...


8-91768
Intell
2003-04-01 19:26
2003.07.28
Передача медиа файла другому приложению.


14-91821
r0n1n
2003-07-09 18:24
2003.07.28
Где достать доки или компоненты для создания чата


14-91823
Soft
2003-07-10 12:43
2003.07.28
Who am I





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский