Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ColorGrd, ComCtrls, StdCtrls, Buttons, ExtCtrls, Menus, ExtDlgs;
- type
- TForm1 = class(TForm)
- mm1: TMainMenu;
- mmiFile: TMenuItem;
- mmiCreate: TMenuItem;
- mmiOpen: TMenuItem;
- mmiSave: TMenuItem;
- mmiSaveAs: TMenuItem;
- mmiExit: TMenuItem;
- mmiStep: TMenuItem;
- pnl1: TPanel;
- btn1: TSpeedButton;
- btn2: TSpeedButton;
- btn3: TSpeedButton;
- btn4: TSpeedButton;
- btn8: TSpeedButton;
- edt1: TEdit;
- ud1: TUpDown;
- pnl2: TPanel;
- clrgrd1: TColorGrid;
- bvl1: TBevel;
- pnl3: TPanel;
- pnl4: TPanel;
- scrlbx1: TScrollBox;
- img1: TImage;
- stat1: TStatusBar;
- dlgOPic1: TOpenPictureDialog;
- dlg1: TSavePictureDialog;
- lbl1: TLabel;
- img2: TImage;
- img3: TImage;
- mmiStepBack: TMenuItem;
- mmiStepForward: TMenuItem;
- N9: TMenuItem;
- mmiWipeOff: TMenuItem;
- mmiSize: TMenuItem;
- mmiHelp: TMenuItem;
- mmiAboutDeveloper: TMenuItem;
- btnRoundRect: TSpeedButton;
- btnRombus: TSpeedButton;
- btnProcedure: TSpeedButton;
- btnHandEnter: TSpeedButton;
- btnUpCycle: TSpeedButton;
- btnDownCycle: TSpeedButton;
- SpeedButton1: TSpeedButton;
- FontDialog1: TFontDialog;
- SpeedButton2: TSpeedButton;
- SpeedButton3: TSpeedButton;
- SpeedButton4: TSpeedButton;
- SpeedButton5: TSpeedButton;
- procedure CreateMemo(x, y, x1, y1: Integer);
- procedure FormCreate(Sender: TObject);
- procedure mmiOpenClick(Sender: TObject);
- procedure ud1Click(Sender: TObject; Button: TUDBtnType);
- procedure clrgrd1Change(Sender: TObject);
- procedure btn1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn2MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn5MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn6MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn7MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btn8MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure edt1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure clrgrd1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure pnl4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure pnl3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure img1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure edt1Change(Sender: TObject);
- procedure img1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure btn5Click(Sender: TObject);
- procedure mmiStepBackClick(Sender: TObject);
- procedure mmiStepForwardClick(Sender: TObject);
- procedure mmiWipeOffClick(Sender: TObject);
- procedure mmiSizeClick(Sender: TObject);
- procedure btn6Click(Sender: TObject);
- procedure btn8Click(Sender: TObject);
- procedure btn7Click(Sender: TObject);
- procedure btn4Click(Sender: TObject);
- procedure btn1Click(Sender: TObject);
- procedure btn3Click(Sender: TObject);
- procedure btn2Click(Sender: TObject);
- procedure mmiSaveClick(Sender: TObject);
- procedure mmiSaveAsClick(Sender: TObject);
- procedure mmiCreateClick(Sender: TObject);
- procedure mmiExitClick(Sender: TObject);
- procedure img1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure mmiAboutDeveloperClick(Sender: TObject);
- procedure btnRoundRectClick(Sender: TObject);
- procedure btnRoundRectMouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure btnRombusClick(Sender: TObject);
- procedure btnProcedureClick(Sender: TObject);
- procedure btnHandEnterClick(Sender: TObject);
- procedure btnDownCycleClick(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure SpeedButton3Click(Sender: TObject);
- procedure SpeedButton4Click(Sender: TObject);
- procedure PNG1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1 : TForm1;
- a, b, c, d: Integer;
- x3,y3 : Real;
- x1,y1,
- x2,y2,
- fat : integer;
- mb : char;
- flag,
- front : integer;
- fname : string;
- backp,
- nextp,
- fopen,
- fsave : boolean;
- implementation
- uses Unit2, Unit3, Unit4;
- {$R *.dfm}
- procedure TForm1.FormCreate(Sender: TObject); // Область рисования
- begin
- fsave := true;
- img1.Canvas.FillRect(img1.Canvas.ClipRect); //Заполняет пpямоугольник, используя кисть Brush, до пpавой и нижней гpаниц, прямоугольник, на котором происходит графический вывод.
- img2.Canvas.FillRect(img2.Canvas.ClipRect);
- img3.Canvas.FillRect(img3.Canvas.ClipRect);
- end;
- procedure TForm1.mmiOpenClick(Sender: TObject);
- begin
- img1.AutoSize := true; //Свойство AutoSize вкл
- fopen := true;
- dlgOPic1.Execute;
- img1.Picture.LoadFromFile(dlgOPic1.FileName); //Загрузка изображения
- fname := dlgOPic1.FileName;
- img1.AutoSize := false; //AutoSize image'a выкл
- end;
- procedure TForm1.ud1Click(Sender: TObject; Button: TUDBtnType);
- begin
- //if not btn5.Down then
- begin
- front := StrToInt(edt1.Text);
- if front <> 0 then
- begin
- if Button = btprev then
- begin
- dec(front);
- if front = 0 then
- front := 1;
- edt1.Text := IntToStr(front);
- end;
- if Button = btnext then
- begin
- Inc(front);
- edt1.Text := IntToStr(front);
- end;
- end;
- end;
- end;
- procedure TForm1.clrgrd1Change(Sender: TObject);
- begin
- pnl4.Color := clrgrd1.ForegroundColor;
- pnl3.color := clrgrd1.BackgroundColor;
- end;
- procedure TForm1.btn1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Стирание части рисунка с помощью '+
- 'ластика выбраного цвета';
- end;
- procedure TForm1.btn2MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Заполнение области одним из текущих цветов';
- end;
- procedure TForm1.btn3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].text := 'Выбор цветов из имеющихся на рисунке';
- end;
- procedure TForm1.btn4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.panels[0].text := 'Проведение прямой линии выбраной толщины';
- end;
- procedure TForm1.btn5MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Проведение произвольной линии толщиной в одну точку';
- end;
- procedure TForm1.btn6MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.panels[0].text := 'Рисование кистью выброной толщины';
- end;
- procedure TForm1.btn7MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Рисование эллипса';
- end;
- procedure TForm1.btn8MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].text := 'Рисование прямоугольника';
- end;
- procedure TForm1.edt1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].text := 'Выбор толщины ';
- end;
- procedure TForm1.clrgrd1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Выбор цветов';
- end;
- procedure TForm1.pnl4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Цвет левой кнопки мыши';
- end;
- procedure TForm1.pnl3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Цвет правой кнопки мыши';
- end;
- procedure TForm1.CreateMemo(x, y, x1, y1: Integer);
- var
- Memo: TMemo;
- begin
- Memo := TMemo.Create(Form1);
- Memo.Parent := Form1;
- Memo.Alignment := taCenter;
- Memo.Color := clWindow;
- Memo.BorderStyle := bsNone;
- //Memo.Font.Style := Memo.Font.Style + [fsBold];
- //Memo.Font.Style := Bold;
- //Memo.SendToBack;
- //Memo.BorderStyle := bsNone;
- //Memo.Alignment := taLeftJustify;
- //Memo.Left := x1 + 5;
- //Memo.Top := y + 5;
- //Memo.Width := x - x1 - 5;
- //Memo.Height := y1 - y - 5;
- Memo.Left := a;
- Memo.Top := b;
- Memo.Width := c;
- Memo.Height := d;
- end;
- procedure TForm1.img1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- begin
- stat1.Panels[0].Text := 'Область для рисования';
- stat1.Panels[1].text := 'x:'+inttostr(x)+ ' y:'+inttostr(y);
- if ((ssRight in Shift) or (ssLeft in Shift)) then
- begin
- fsave := false;
- backp := true;
- nextp := false;
- if btn1.Down then
- begin
- img1.Canvas.Pen.color:=pnl3.Color;
- img1.Canvas.pen.Width:=strtoint((edt1.text));
- Img1.Canvas.lineto(x,y);
- end;
- {if btn5.down then //pencil
- begin
- if mb = 'l' then
- img1.Canvas.Pen.Color := pnl4.Color
- else
- img1.Canvas.Pen.Color := pnl3.Color;
- img1.Canvas.LineTo(x,y);
- end; }
- {if btn6.Down then
- begin
- img1.canvas.Pen.Width := strtoint(edt1.Text);
- if mb = 'l' then
- img1.Canvas.Pen.Color := pnl4.Color
- else
- img1.Canvas.Pen.Color := pnl3.Color;
- img1.canvas.lineto(x,y);
- end; }
- {if btn7.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- img1.Canvas.Brush.Style := bsSolid;
- Img1.Canvas.ellipse(x,y,x1,y1);
- end;}
- if btn8.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- img1.Canvas.Brush.Style := bsSolid;
- img1.Canvas.Rectangle(x,y,x1,y1);
- end;
- if btnProcedure.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- //x3 := (x1+x)/4;
- x3 := (x-x1)/3;
- img1.Canvas.Brush.Style := bsSolid;
- //img1.Canvas.Polygon([Point(x1,y1), Point(x1-round(x3),y), Point(x,y), Point(x+round(x3),y1)]);
- img1.Canvas.Polygon([Point(x1,y1), Point(x1-round(x3),y), Point(x,y), Point(x+round(x3), y1)]);
- //img1.Canvas.Polygon([Point(round(x3), y), Point(round(x3), y1)],
- // Point(x, y1), Point(x, y),
- // Point(x1-round(x3), y), Point(x1-round(x3), y1), Point(round(x3), y1)]);
- //img1.Canvas.Polygon([Point(100,100), Point(200,200), Point(250,145), Point(300,350)]);
- end;
- if btnHandEnter.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- //x3 := (x+x1)/5;
- //y3 := (y+y1)/4;
- y3 := (y-y1)/2;
- img1.Canvas.Brush.Style := bsSolid;
- img1.Canvas.Polygon([Point(x1,y1), Point(x1,y), Point(x,y), Point(x,y1),
- Point(x,y1- round(y3))]);
- end;
- if btnUpCycle.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- //x3 := (x+x1)/8;
- x3 := (x-x1)/5;
- y3 := (y-y1)/5;
- //y3 := 3*y/4;
- //y3 := (y+y1)/14;
- img1.Canvas.Brush.Style := bsSolid;
- img1.Canvas.Polygon([Point(x1,y1), Point(x1,y), Point(x,y), Point(x,y1),
- Point(x- round(x3),y1- round(y3)), Point(x1+round(x3),y1- round(y3))]);
- //img1.Canvas.Polygon([Point(x1,y1), Point(x1,y), Point(x- round(x3),y + round(y3)),
- //Point(x1 + 2*round(x3), y + round(y3)), Point(x+ round(x3), y), Point(x+ round(x3), y1)]);
- end;
- if btnDownCycle.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- //x3 := (x+x1)/8;
- x3 := (x-x1)/5;
- //y3 := 3*y/4;
- //y3 := (y+y1)/14;
- y3 := (y-y1)/5;
- img1.Canvas.Brush.Style := bsSolid;
- //img1.Canvas.Polygon([Point(x1,y1), Point(x1,y), Point(x,y), Point(x,y1),
- //Point(x- round(x3),y1- round(y3)), Point(x1+round(x3),y1- round(y3))]);
- img1.Canvas.Polygon([Point(x1,y1), Point(x1,y), Point(x1 + round(x3),y + round(y3)),
- Point(x - round(x3), y + round(y3)), Point(x, y), Point(x, y1)]);
- end;
- a := x1+87;
- b := y1+15;
- c := x-x1-8;
- d := y-y1-8;
- if btn4.down then
- begin
- img1.picture.Assign(img2.picture);
- if mb = 'l' then
- Img1.Canvas.Pen.color := pnl4.Color
- else
- Img1.Canvas.Pen.color := pnl3.Color;
- Img1.Canvas.Pen.width := strtoint(edt1.text);
- Img1.Canvas.moveto(x,y);
- Img1.Canvas.lineto(x1,y1);
- a := 0;
- b := 0;
- c := 0;
- d := 0;
- end;
- if btnRoundRect.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- img1.Canvas.Brush.Style := bsSolid;
- img1.Canvas.RoundRect(x,y,x1,y1, 100, 100);
- a := x1+119;
- b := y1+15;
- c := x-x1-71;
- d := y-y1-8;
- end;
- if btnRombus.Down then
- begin
- img1.picture.Assign(img2.picture);
- img1.Canvas.pen.Width := strtoint(edt1.text);
- if mb = 'r' then
- img1.Canvas.Pen.color := pnl3.Color
- else
- //x3 := (x+x1)/2;
- //y3 := (y+y1)/2;
- x3 := (x-x1)/2;
- y3 := (y-y1)/2;
- img1.Canvas.Brush.Style := bsSolid;
- //img1.Canvas.Polygon([Point(x, round(y3)), Point(round(x3), y), Point(x1, round(y3)), Point(round(x3), y1)]);
- img1.Canvas.Polygon([Point(x1, y1), Point(x1+round(x3), y1-round(y3)), Point(x, y1),
- Point(x+round(x3), y1+round(y3)), Point(x, y), Point(x1+round(x3), y+round(y3)), Point(x1, y),
- Point(x1-round(x3), y1+round(y3))]);
- //img1.Canvas.Polygon([Point(100,100), Point(200,200), Point(250,145), Point(300,350)]);
- a := x1+84;
- b := y1+10;
- c := x-x1-3;
- d := y-y1;
- end;
- end;
- x2 := x;
- y2 := y;
- end;
- procedure TForm1.img1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- begin
- if btn2.Down then
- begin
- if button = mbRight then
- Img1.Canvas.brush.color := pnl3.Color
- else
- Img1.Canvas.brush.color := pnl4.Color;
- Img1.Canvas.FloodFill(x, y,Img1.Canvas.Pixels[x,y], fssurface);
- end;
- if btn3.Down then
- begin
- if button = mbRight then
- pnl3.Color := Img1.Canvas.pixels[x,y]
- else
- pnl4.color := Img1.Canvas.pixels[x,y];
- end;
- CreateMemo(a, b, c, d);
- end;
- procedure TForm1.img1MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- begin
- img2.picture.Assign(img1.Picture);
- x1 := x;
- y1 := y;
- if button = mbRight then
- mb := 'r'
- else
- mb := 'l';
- img1.Canvas.MoveTo(x,y);
- Img1MouseMove(Sender,Shift,X,Y);
- end;
- procedure TForm1.edt1Change(Sender: TObject);
- begin
- fat := strtoint(edt1.text);
- //if not btn5.Down then
- // img1.Canvas.Pen.Width := fat;
- If edt1.text='0' then Messagedlg('Толщина не может быть равна 0!',
- mtInformation,[mbok],0);
- If edt1.text='0' then Edt1.Text := '1';
- end;
- procedure TForm1.btn5Click(Sender: TObject);
- begin
- img1.Canvas.Pen.Width := 1;
- lbl1.Visible := false;
- edt1.Visible := false;
- end;
- procedure TForm1.mmiStepBackClick(Sender: TObject);
- begin
- if backp = true then
- begin
- img3.picture.Assign(img1.Picture);
- img1.picture.Assign(img2.Picture);
- nextp := true;
- end;
- backp := false;
- end;
- procedure TForm1.mmiStepForwardClick(Sender: TObject);
- begin
- if nextp = true then
- begin
- img2.Picture.Assign(img1.Picture);
- img1.Picture.Assign(img3.Picture);
- backp := true;
- end;
- nextp := false;
- end;
- procedure TForm1.mmiWipeOffClick(Sender: TObject);
- var
- i:Integer;
- //Memo1: TMemo;
- c: TControl;
- begin
- img1.Picture := nil;
- img1.Canvas.FillRect(img1.Canvas.ClipRect);
- img2.Picture := nil;
- img2.Canvas.FillRect(img2.Canvas.ClipRect);
- img3.Picture := nil;
- img3.Canvas.FillRect(img3.Canvas.ClipRect);
- backp := false;
- nextp := false;
- for i:= self.ControlCount - 1 downto 0 do
- begin
- c := self.Controls[i];
- if c is TMemo then
- begin
- c.Parent := nil;
- c.Free;
- end;
- end;
- //Memo.SendToBack;
- //Memo.Parent := Form1;;
- end;
- procedure TForm1.mmiSizeClick(Sender: TObject);
- begin
- Form2.ShowModal;
- end;
- procedure TForm1.btn6Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btn8Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btnRombusClick(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btnRoundRectClick(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btnRoundRectMouseMove(Sender: TObject; Shift: TShiftState;
- X, Y: Integer);
- begin
- stat1.Panels[0].Text := 'Рисование круглого прямоугольника';
- end;
- procedure TForm1.btn7Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btn4Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btn1Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btn3Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btn2Click(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.mmiSaveClick(Sender: TObject);
- var
- bmp: TBitmap;
- begin
- if fopen then
- begin
- try
- bmp := TBitmap.Create;
- bmp.Assign(img1.Picture);
- bmp.SaveTofile(ChangeFileExt(fname, '.bmp'));
- finally
- bmp.Free;
- end;
- end
- else
- begin
- dlg1.Execute;
- try
- bmp := TBitmap.Create;
- bmp.Assign(img1.Picture);
- bmp.SaveTofile(ChangeFileExt(dlg1.FileName, '.bmp'));
- finally
- bmp.Free;
- end;
- fopen := true;
- end;
- fsave := true;
- end;
- procedure TForm1.mmiSaveAsClick(Sender: TObject);
- var
- bmp: TBitmap;
- begin
- dlg1.Execute;
- try
- bmp := TBitmap.Create;
- bmp.Assign(img1.Picture);
- bmp.SaveTofile(ChangeFileExt(dlg1.FileName, '.bmp'));
- finally
- bmp.Free;
- end;
- fsave := true;
- end;
- procedure TForm1.mmiCreateClick(Sender: TObject);
- begin
- if fsave <> true then
- begin
- Form4.ShowModal;
- end
- else
- begin
- fopen := false;
- img1.Picture := nil;
- img1.Canvas.FillRect(img1.Canvas.ClipRect);
- img2.Picture := nil;
- img2.Canvas.FillRect(img2.Canvas.ClipRect);
- img3.Picture := nil;
- img3.Canvas.FillRect(img3.Canvas.ClipRect);
- backp := false;
- nextp := false;
- end;
- end;
- procedure TForm1.mmiExitClick(Sender: TObject);
- begin
- if fsave <> true then
- begin
- Form4.ShowModal;
- end;
- if fsave = true then
- form1.Close;
- end;
- procedure TForm1.mmiAboutDeveloperClick(Sender: TObject);
- begin
- Messagedlg('Программа разработана Буйко Викторией, гр.851002',
- mtInformation,[mbok],0);
- end;
- procedure TForm1.btnProcedureClick(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btnHandEnterClick(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.btnDownCycleClick(Sender: TObject);
- begin
- lbl1.Visible := true;
- edt1.Visible := true;
- ud1.Visible := true;
- end;
- procedure TForm1.SpeedButton1Click(Sender: TObject);
- var
- i: Integer;
- Memo: TMemo;
- c: TControl;
- begin
- if FontDialog1.Execute then
- for i:= self.ControlCount - 1 downto 0 do
- begin
- c := self.Controls[i];
- if c is TMemo then
- begin
- //Font.Style := Font.Style + [fsBold];
- Font.size := FontDialog1.Font.Size;
- Font.style := FontDialog1.Font.Style;
- Font.color := FontDialog1.Font.Color;
- //c.Font.Style := Font.Style + [fsBold];
- //c.
- end;
- end;
- edt1.Font.Size := 8;
- clrgrd1.Font.Size := 8;
- lbl1.Font.Size := 8;
- edt1.Font.Style := edt1.Font.Style - [fsBold];
- edt1.Font.Style := edt1.Font.Style - [fsItalic];
- edt1.Font.Style := edt1.Font.Style - [fsUnderline];
- lbl1.Font.Style := lbl1.Font.Style - [fsBold];
- lbl1.Font.Style := lbl1.Font.Style - [fsItalic];
- lbl1.Font.Style := lbl1.Font.Style - [fsUnderline];
- //lbl1.Font.Style := lbl1.Font.Style + [fsNormal];
- //if FontDialog1.Execute then
- //with Sender as TMemo do
- {begin
- (Sender as TMemo).Font.size := FontDialog1.Font.Size;
- Font.style := FontDialog1.Font.Style;
- Font.color := FontDialog1.Font.Color;
- // Font := FontDialog1.Font;
- end; }
- //Memo.Parent := Form1;
- //with Sender as TMemo do
- //Font.Style := Font.Style + [fsBold];
- //Memo.Font.Style := Memo.Font.Style + [fsBold];
- end;
- procedure TForm1.SpeedButton2Click(Sender: TObject);
- var
- i: Integer;
- c: TControl;
- begin
- for i:= self.ControlCount - 1 downto 0 do
- begin
- c := self.Controls[i];
- if c is TMemo then
- begin
- Font.Style := Font.Style + [fsBold];
- end;
- end;
- clrgrd1.Font.Size := 8;
- edt1.Font.Style := edt1.Font.Style - [fsBold];
- lbl1.Font.Style := lbl1.Font.Style - [fsBold];
- end;
- procedure TForm1.SpeedButton3Click(Sender: TObject);
- var
- i: Integer;
- c: TControl;
- begin
- for i:= self.ControlCount - 1 downto 0 do
- begin
- c := self.Controls[i];
- if c is TMemo then
- begin
- Font.Style := Font.Style + [fsItalic];
- Font.Name := 'TimesNewRoman';
- end;
- end;
- clrgrd1.Font.Size := 8;
- edt1.Font.Name := 'MS Sans Serif';
- lbl1.Font.Name := 'MS Sans Serif';
- edt1.Font.Style := edt1.Font.Style - [fsItalic];
- lbl1.Font.Style := lbl1.Font.Style - [fsItalic];
- end;
- procedure TForm1.SpeedButton4Click(Sender: TObject);
- var
- i: Integer;
- c: TControl;
- begin
- for i:= self.ControlCount - 1 downto 0 do
- begin
- c := self.Controls[i];
- if c is TMemo then
- begin
- Font.Style := Font.Style + [fsUnderline];
- Font.Name := 'TimesNewRoman';
- end;
- end;
- clrgrd1.Font.Size := 8;
- edt1.Font.Name := 'MS Sans Serif';
- lbl1.Font.Name := 'MS Sans Serif';
- edt1.Font.Style := edt1.Font.Style - [fsUnderline];
- lbl1.Font.Style := lbl1.Font.Style - [fsUnderline];
- end;
- procedure TForm1.PNG1Click(Sender: TObject);
- var
- bmp: TBitmap;
- begin
- dlg1.Execute;
- try
- bmp := TBitmap.Create;
- bmp.Assign(img1.Picture);
- bmp.SaveTofile(ChangeFileExt(dlg1.FileName, '.jpg'));
- finally
- bmp.Free;
- end;
- fsave := true;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement