안녕하십니까.
이즈니 입니다.
아직은 미완성이라 우선 소스부분만 발췌하여 올립니다.
델파이 7 + JEDI : 첨부파일은 실행파일만 압축되어 있습니다. ^^;;
------------------------------------------------------------------------------------
unit MiniPaintMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XPMan, Jpeg, Clipbrd, DB, JvTrayIcon, JvDataSource, JvMemoryDataset,
Menus, JvMenus, ExtCtrls, ImgList, JvComponentBase, JvBalloonHint, ExtDlgs,
JvSlider, Grids, DBGrids, JvExDBGrids, JvDBGrid, JvDBUltimGrid, JvZoom, JvLED,
StdCtrls, JvExStdCtrls, JvRadioButton, JvOfficeColorPanel, JvCheckBox, JvBevel,
JvExControls, JvxSlider, JvCombobox, Buttons, JvExButtons, JvButtons, JvGradient,
JvExExtCtrls, JvSpecialImage, JvExtComponent, JvPanel, JvButton, JvTransparentButton;
type
TMiniPaintMainForm = class(TForm)
XPManifest1: TXPManifest;
SaveBmpDialog: TSaveDialog;
SaveJpgDialog: TSaveDialog;
OpenPicDlalig: TOpenPictureDialog;
ModeBevel: TJvBevel;
MainPanel: TJvPanel;
MyImage: TJvSpecialImage;
MyPaintBox: TPaintBox;
SaveBmpButton: TJvHTButton;
SaveJpgButton: TJvHTButton;
ExitButton: TJvHTButton;
OpenButton: TJvHTButton;
NewButton: TJvHTButton;
ModeButton: TJvHTButton;
PenWidthComboBox: TJvComboBox;
LineRadioButton: TJvRadioButton;
EllipseRadioButton: TJvRadioButton;
RectangleRadioButton: TJvRadioButton;
FillRectRadioButton: TJvRadioButton;
FillColorRadioButton: TJvRadioButton;
InvertedCheckBox: TJvCheckBox;
MirroredCheckBox: TJvCheckBox;
FlippedCheckBox: TJvCheckBox;
BrightSlider: TJvxSlider;
ColorPanel: TJvOfficeColorPanel;
PenStyleComboBox: TJvComboBox;
BrushStyleComboBox: TJvComboBox;
BalloonHint: TJvBalloonHint;
RotateImageList: TImageList;
RotateTimer: TTimer;
SizePopup: TJvPopupMenu;
pMenu1: TMenuItem;
pMenu2: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
pMenu3: TMenuItem;
pMenu4: TMenuItem;
pMenu5: TMenuItem;
pMenu6: TMenuItem;
pMenu7: TMenuItem;
pMenu8: TMenuItem;
LEDPanel: TJvPanel;
ImageSizeLED: TJvLED;
AboutButton: TJvTransparentButton;
Zoom: TJvZoom;
ZoomComboBox: TJvComboBox;
ZoomButton: TJvHTButton;
MemoryDB: TJvMemoryData;
FilesDataSource: TJvDataSource;
FilesDBUltimGrid: TJvDBUltimGrid;
MemoryDBmFiles: TStringField;
MemoryDBmGubun: TStringField;
MemoryDBmDate: TStringField;
MemoryDBpMenu1: TBooleanField;
BackGroundGradient: TJvGradient;
HelpButton: TJvTransparentButton;
FilesButton: TJvTransparentButton;
SliderX: TJvSlider;
SliderY: TJvSlider;
SizePanel: TJvPanel;
MiniPaintTrayIcon: TJvTrayIcon;
MiniTrayPopup: TJvPopupMenu;
TrayMenu1: TMenuItem;
TrayMenu2: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormActivate(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure MyPaintBoxClick(Sender: TObject);
procedure MyPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MyPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure MyPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MyPaintBoxPaint(Sender: TObject);
procedure SaveBmpButtonClick(Sender: TObject);
procedure SaveJpgButtonClick(Sender: TObject);
procedure ExitButtonClick(Sender: TObject);
procedure OpenButtonClick(Sender: TObject);
procedure NewButtonClick(Sender: TObject);
procedure ModeButtonClick(Sender: TObject);
procedure SizePopupPopup(Sender: TObject);
procedure pMenu1Click(Sender: TObject);
procedure pMenu3Click(Sender: TObject);
procedure pMenu4Click(Sender: TObject);
procedure pMenu5Click(Sender: TObject);
procedure pMenu6Click(Sender: TObject);
procedure pMenu7Click(Sender: TObject);
procedure pMenu8Click(Sender: TObject);
procedure PenWidthComboBoxChange(Sender: TObject);
procedure InvertedCheckBoxClick(Sender: TObject);
procedure ColorPanelColorChange(Sender: TObject);
procedure RotateTimerTimer(Sender: TObject);
procedure ImageSizeLEDClick(Sender: TObject);
procedure PenWidthComboBoxKeyPress(Sender: TObject; var Key: Char);
procedure AboutButtonClick(Sender: TObject);
procedure ZoomComboBoxChange(Sender: TObject);
procedure ZoomButtonClick(Sender: TObject);
procedure FilesButtonClick(Sender: TObject);
procedure FilesDBUltimGridCellClick(Column: TColumn);
procedure FilesDBUltimGridDblClick(Sender: TObject);
procedure FilesDBUltimGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure FilesDBUltimGridKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure SliderXChanged(Sender: TObject);
procedure SizePanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure SizePanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure SizePanelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TrayMenu1Click(Sender: TObject);
procedure MiniPaintTrayIconClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
procedure MiniPaintTrayIconShowHide;
procedure pMenuSetCursorPosPopup;
procedure ControlMouseEvent( Sender: TWinControl );
procedure ControlsInitial( Init: Boolean; Sender: TObject );
procedure MemoryDBSave( mFile, mOpen: String; mDate: TDateTime );
procedure PictureFileOpen( Sender: TObject );
procedure FileNameChange;
procedure MyPaintBoxMouseProcess( X, Y: Integer; Move: Boolean );
procedure AnyMessage( var Msg: TMsg; var Handled: Boolean );
public
{ Public declarations }
end;
var
MiniPaintMainForm: TMiniPaintMainForm;
ScreenDC: HDC;
FormHeight: Integer;
FileName: String;
PublicBitmap: TBitmap;
PublicPoint: TPoint;
PublicTempPoint: TPoint;
PublicOpenPoint: TPoint;
PublicpMenu1Bool: Boolean;
PublicSizePoint: TPoint;
PublicSizeBool: Boolean;
implementation
uses About;
{$R *.dfm}
procedure TMiniPaintMainForm.MiniPaintTrayIconShowHide;
begin
if IsWindowVisible( Handle ) then MiniPaintTrayIcon.HideApplication
else MiniPaintTrayIcon.ShowApplication;
end;
procedure TMiniPaintMainForm.pMenuSetCursorPosPopup;
begin
SetCursorPos( PublicPoint.X, PublicPoint.Y );
SizePopup.Popup( PublicPoint.X, PublicPoint.Y );
end;
procedure TMiniPaintMainForm.ControlMouseEvent( Sender: TWinControl );
begin
GetCursorPos( PublicTempPoint );
PublicPoint := ClientToScreen( Point( 0, 0 ) );
SetCursorPos( PublicPoint.X + Sender.Left + Sender.Width - 10, PublicPoint.Y + Sender.Top + 10 );
Mouse_Event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
Mouse_Event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
SetCursorPos( PublicTempPoint.X, PublicTempPoint.Y );
end;
procedure TMiniPaintMainForm.ControlsInitial( Init: Boolean; Sender: TObject );
begin
if Init then begin
InvertedCheckBox.Checked := false;
MirroredCheckBox.Checked := false;
FlippedCheckBox.Checked := false;
BrightSlider.Value := 100;
MyImage.Inverted := InvertedCheckBox.Checked;
MyImage.Mirrored := MirroredCheckBox.Checked;
MyImage.Flipped := FlippedCheckBox.Checked;
MyImage.Brightness := BrightSlider.Value;
end else begin
if Sender = InvertedCheckBox then MyImage.Inverted := InvertedCheckBox.Checked else
if Sender = MirroredCheckBox then MyImage.Mirrored := MirroredCheckBox.Checked else
if Sender = FlippedCheckBox then MyImage.Flipped := FlippedCheckBox.Checked else
if Sender = BrightSlider then MyImage.Brightness := BrightSlider.Value;
end;
BrightSlider.Hint := '밝기(' + IntToStr( BrightSlider.Value ) + '): Shift+9';
end;
procedure TMiniPaintMainForm.MemoryDBSave( mFile, mOpen: String; mDate: TDateTime );
begin
with MemoryDB do begin
try
First;
Insert;
FieldByName( 'mFile' ).AsString := mFile;
FieldByName( 'mOpen' ).AsString := mOpen;
FieldByName( 'mDate' ).AsString := DateTimeToStr( mDate );
FieldByName( 'pMenu1' ).AsBoolean := PublicpMenu1Bool;
Post;
except
Cancel;
end;
end;
end;
procedure TMiniPaintMainForm.PictureFileOpen( Sender: TObject );
begin
try
ControlsInitial( true, Sender );
MyImage.Picture.Assign( nil );
MyImage.Stretch := not ImageSizeLED.Status;
MyPaintBox.Visible := false;
MyImage.Picture.LoadFromFile( FileName );
MyImage.Refresh;
if ( MyImage.Stretch ) or ( Sender = pMenu1 ) then begin
PublicBitmap.Width := MainPanel.Width;
PublicBitmap.Height := MainPanel.Height;
PublicPoint := ClientToScreen( Point( 0, 0 ) );
BitBlt( PublicBitmap.Canvas.Handle, 0, 0, PublicBitmap.Width, PublicBitmap.Height, ScreenDC, PublicPoint.X + MainPanel.Left, PublicPoint.Y + MainPanel.Top, SRCCOPY );
MyImage.Picture.Assign( PublicBitmap );
end else begin
PublicBitmap.Width := MyImage.Picture.Width;
PublicBitmap.Height := MyImage.Picture.Height;
end;
MyPaintBox.Visible := true;
FileNameChange;
except
MyPaintBox.Visible := true;
MyImage.Refresh;
FileName := '제목 없음.bmp';
FileNameChange;
end;
end;
procedure TMiniPaintMainForm.FileNameChange;
begin
Caption := FileName + ' (' + IntToStr( MainPanel.Width ) + '×' + IntToStr( MainPanel.Height ) + ')';
Application.Title := '작은 그림판 - ' + Caption;
MiniPaintTrayIcon.Hint := Application.Title;
SaveBmpDialog.FileName := ChangeFileExt( FileName, '.bmp' );
SaveJpgDialog.FileName := ChangeFileExt( FileName, '.jpg' );
end;
procedure TMiniPaintMainForm.MyPaintBoxMouseProcess( X, Y: Integer; Move: Boolean );
var MyPaintBoxRec: TRect;
begin
if EllipseRadioButton.Checked then MyPaintBox.Canvas.Ellipse( PublicPoint.X, PublicPoint.Y, X, Y ) else
if RectangleRadioButton.Checked then MyPaintBox.Canvas.Rectangle( PublicPoint.X, PublicPoint.Y, X, Y ) else
if FillRectRadioButton.Checked then begin
MyPaintBoxRec := Rect( PublicPoint.X, PublicPoint.Y, X, Y );
MyPaintBox.Canvas.Brush.Color := ColorPanel.SelectedColor;
MyPaintBox.Canvas.FillRect( MyPaintBoxRec );
end;
if Move then MyImage.Picture.Assign( PublicBitmap )
else MyImage.Canvas.CopyRect( MyPaintBox.Canvas.ClipRect, MyPaintBox.Canvas, MyPaintBox.BoundsRect );
end;
procedure TMiniPaintMainForm.AnyMessage( var Msg: TMsg; var Handled: Boolean );
begin
if Msg.message = WM_MouseWheel then begin
if ActiveControl is TJvDBGrid then begin
if Msg.wParam > 0 then begin
KeyBd_Event( VK_UP, VK_UP, KEYEVENTF_KEYUP, 0 );
ActiveControl.Invalidate;
end else if Msg.wParam < 0 then begin
KeyBd_Event( VK_DOWN, VK_DOWN, KEYEVENTF_KEYUP, 0 );
ActiveControl.Invalidate;
end;
end;
end;
end;
procedure TMiniPaintMainForm.FormCreate(Sender: TObject);
var Count: Integer;
begin
Application.OnMessage := AnyMessage;
ScreenDC := GetDC( 0 );
FormHeight := MiniPaintMainForm.Height;
FileName := '제목 없음.bmp';
FileNameChange;
PublicpMenu1Bool := true;
PublicSizeBool := false;
MemoryDB.Open;
MiniPaintMainForm.DoubleBuffered := true;
for Count := 0 to ComponentCount - 1 do
if not ( Components[ Count ] is TJvxSlider ) and ( Components[ Count ] is TWinControl ) then TWinControl( Components[ Count ] ).DoubleBuffered := true;
PublicBitmap := TBitmap.Create;
PublicBitmap.Width := MainPanel.Width;
PublicBitmap.Height := MainPanel.Height;
Zoom.ZoomPercentage := StrToInt( ZoomComboBox.Text );
MyImage.Proportional := pMenu8.Checked;
MyPaintBox.Canvas.Pen.Width := StrToInt( PenWidthComboBox.Text );
SliderX.Hint := '넓이: ' + IntToStr( MainPanel.Width );
SliderY.Hint := '높이: ' + IntToStr( MainPanel.Height );
MiniPaintTrayIcon.Active := true;
MiniPaintTrayIcon.ShowApplication;
end;
procedure TMiniPaintMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ReleaseDC( 0, ScreenDC );
PublicBitmap.Free;
end;
procedure TMiniPaintMainForm.FormActivate(Sender: TObject);
begin
MainPanel.SetFocus;
end;
procedure TMiniPaintMainForm.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_ESCAPE then begin
Key := 0; MyImage.Picture.Assign( PublicBitmap );
end else if ssShift in Shift then begin
case Key of
Ord( '1' ) : begin Key := 0; LineRadioButton.Checked := true; end;
Ord( '2' ) : begin Key := 0; EllipseRadioButton.Checked := true; end;
Ord( '3' ) : begin Key := 0; RectangleRadioButton.Checked := true; end;
Ord( '4' ) : begin Key := 0; FillRectRadioButton.Checked := true; end;
Ord( '5' ) : begin Key := 0; FillColorRadioButton.Checked := true; end;
Ord( '6' ) : begin Key := 0; InvertedCheckBox.Checked := not InvertedCheckBox.Checked; end;
Ord( '7' ) : begin Key := 0; MirroredCheckBox.Checked := not MirroredCheckBox.Checked; end;
Ord( '8' ) : begin Key := 0; FlippedCheckBox.Checked := not FlippedCheckBox.Checked; end;
Ord( '9' ) : begin Key := 0; if ModeButton.Tag in [ 1..2 ] then ControlMouseEvent( BrightSlider ); end;
end;
end else if ssCtrl in Shift then begin
case Key of
Ord( 'A' ) : begin Key := 0; AboutButtonClick( Sender ); end;
Ord( 'B' ) : begin Key := 0; SaveBmpButtonClick( Sender ); end;
Ord( 'J' ) : begin Key := 0; SaveJpgButtonClick( Sender ); end;
Ord( 'X' ) : begin Key := 0; ExitButtonClick( Sender ); end;
Ord( 'O' ) : begin Key := 0; OpenButtonClick( Sender ); end;
Ord( 'N' ) : begin Key := 0; NewButtonClick( Sender ); end;
Ord( 'M' ) : begin Key := 0; ModeButtonClick( Sender ); end;
Ord( 'U' ) : begin Key := 0; ImageSizeLEDClick( Sender ); end;
Ord( 'F' ) : begin Key := 0; FilesButtonClick( Sender ); end;
Ord( 'S' ) : begin Key := 0; ZoomButtonClick( Sender ); end;
Ord( 'W' ) : begin Key := 0; ControlMouseEvent( PenWidthComboBox ); end;
Ord( 'P' ) : begin Key := 0; if ModeButton.Tag in [ 1..2 ] then ControlMouseEvent( PenStyleComboBox ); end;
Ord( 'R' ) : begin Key := 0; if ModeButton.Tag in [ 1..2 ] then ControlMouseEvent( BrushStyleComboBox ); end;
Ord( 'Z' ) : begin Key := 0; if ModeButton.Tag in [ 2 ] then ControlMouseEvent( ZoomComboBox ); end;
Ord( 'C' ) : begin Key := 0; Clipboard.Assign( MyImage.Picture.Bitmap ); end;
Ord( 'V' ) : begin Key := 0; try MyImage.Picture.Bitmap.Assign( Clipboard ); except end; end;
Ord( '1' ) : begin Key := 0; ModeButton.Tag := 2; ModeButtonClick( Sender ); end;
Ord( '2' ) : begin Key := 0; ModeButton.Tag := 0; ModeButtonClick( Sender ); end;
Ord( '3' ) : begin Key := 0; ModeButton.Tag := 1; ModeButtonClick( Sender ); end;
end;
end;
end;
procedure TMiniPaintMainForm.MyPaintBoxClick(Sender: TObject);
begin
if not MainPanel.Focused then MainPanel.SetFocus;
end;
procedure TMiniPaintMainForm.MyPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PublicPoint.X := X;
PublicPoint.Y := Y;
case PenStyleComboBox.ItemIndex of
0 : MyPaintBox.Canvas.Pen.Style := psSolid;
1 : MyPaintBox.Canvas.Pen.Style := psDash;
2 : MyPaintBox.Canvas.Pen.Style := psDot;
3 : MyPaintBox.Canvas.Pen.Style := psDashDot;
4 : MyPaintBox.Canvas.Pen.Style := PsDashDotDot;
5 : MyPaintBox.Canvas.Pen.Style := psClear;
6 : MyPaintBox.Canvas.Pen.Style := psInsideFrame;
end;
case BrushStyleComboBox.ItemIndex of
0 : MyPaintBox.Canvas.Brush.Style := bsSolid;
1 : MyPaintBox.Canvas.Brush.Style := bsClear;
2 : MyPaintBox.Canvas.Brush.Style := bsHorizontal;
3 : MyPaintBox.Canvas.Brush.Style := bsVertical;
4 : MyPaintBox.Canvas.Brush.Style := bsFDiagonal;
5 : MyPaintBox.Canvas.Brush.Style := bsBDiagonal;
6 : MyPaintBox.Canvas.Brush.Style := bsCross;
7 : MyPaintBox.Canvas.Brush.Style := bsDiagCross;
end;
MyPaintBox.Canvas.MoveTo( X, Y );
PublicBitmap.Assign( MyImage.Picture );
if LineRadioButton.Checked then MyPaintBox.Canvas.LineTo( X, Y ) else
if FillColorRadioButton.Checked then begin
MyPaintBox.Canvas.Brush.Color := ColorPanel.SelectedColor;
MyPaintBox.Canvas.FillRect( MyPaintBox.Canvas.ClipRect );
end;
end;
procedure TMiniPaintMainForm.MyPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if ssLeft in Shift then if LineRadioButton.Checked then MyPaintBox.Canvas.LineTo( X, Y )
else MyPaintBoxMouseProcess( X, Y, true );
end;
procedure TMiniPaintMainForm.MyPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MyPaintBoxMouseProcess( X, Y, false );
end;
procedure TMiniPaintMainForm.MyPaintBoxPaint(Sender: TObject);
begin
try
MyPaintBox.Canvas.CopyRect( MyPaintBox.BoundsRect, MyImage.Canvas, MyPaintBox.Canvas.ClipRect );
except
ControlsInitial( true, Sender );
end;
end;
procedure TMiniPaintMainForm.SaveBmpButtonClick(Sender: TObject);
begin
PublicPoint := ClientToScreen( Point( 0, 0 ) );
PublicBitmap.Width := MainPanel.Width; PublicBitmap.Height := MainPanel.Height;
BitBlt( PublicBitmap.Canvas.Handle, 0, 0, PublicBitmap.Width, PublicBitmap.Height, ScreenDC, PublicPoint.X + MainPanel.Left, PublicPoint.Y + MainPanel.Top, SRCCOPY );
if SaveBmpDialog.Execute then begin
PublicBitmap.SaveToFile( SaveBmpDialog.FileName );
FileName := SaveBmpDialog.FileName;
FileNameChange;
MemoryDBSave( FileName, '비트맵 저장', Now );
end;
end;
procedure TMiniPaintMainForm.SaveJpgButtonClick(Sender: TObject);
var Jpg: TJpegImage;
begin
Jpg := TJpegImage.Create;
PublicPoint := ClientToScreen( Point( 0, 0 ) );
PublicBitmap.Width := MainPanel.Width; PublicBitmap.Height := MainPanel.Height;
BitBlt( PublicBitmap.Canvas.Handle, 0, 0, PublicBitmap.Width, PublicBitmap.Height, ScreenDC, PublicPoint.X + MainPanel.Left, PublicPoint.Y + MainPanel.Top, SRCCOPY );
Jpg.Assign( PublicBitmap );
if SaveJpgDialog.Execute then begin
Jpg.SaveToFile( SaveJpgDialog.FileName );
FileName := SaveJpgDialog.FileName;
FileNameChange;
MemoryDBSave( FileName, 'JPG 저장', Now );
end;
Jpg.Free;
end;
procedure TMiniPaintMainForm.ExitButtonClick(Sender: TObject);
begin
MemoryDB.Close;
Close;
end;
procedure TMiniPaintMainForm.OpenButtonClick(Sender: TObject);
begin
GetCursorPos( PublicPoint );
GetCursorPos( PublicTempPoint );
GetCursorPos( PublicOpenPoint );
if pMenu3.Checked then pMenu1Click( pMenu1 ) else
if pMenu4.Checked then pMenu1Click( pMenu2 ) else SizePopup.Popup( PublicPoint.X, PublicPoint.Y );
end;
procedure TMiniPaintMainForm.NewButtonClick(Sender: TObject);
begin
PublicpMenu1Bool := true;
ControlsInitial( true, Sender );
MyImage.Picture.Assign( nil );
FileName := '제목 없음.bmp';
FileNameChange;
end;
procedure TMiniPaintMainForm.ModeButtonClick(Sender: TObject);
var FieldCount: Integer;
begin
case ModeButton.Tag of
0 : begin
ModeButton.Caption := '기본 (M)';
ModeButton.Tag := ModeButton.Tag + 1;
ModeButton.Font.Color := clBlue;
MiniPaintMainForm.Width := 570;
ZoomButton.Caption := '정지 (S)';
Zoom.Active := false;
end;
1 : begin
ModeButton.Caption := '확대 (M)';
ModeButton.Tag := ModeButton.Tag + 1;
ModeButton.Font.Color := clFuchsia;
MiniPaintMainForm.Width := 732;
ZoomButton.Caption := '동작 (S)';
Zoom.Active := true;
SetCursorPos( Mouse.CursorPos.X, Mouse.CursorPos.Y + 1 );
Zoom.Refresh;
SetCursorPos( Mouse.CursorPos.X, Mouse.CursorPos.Y - 1 );
end;
2 : begin
ModeButton.Caption := '최소 (M)';
ModeButton.Tag := 0;
ModeButton.Font.Color := clWindowText;
MiniPaintMainForm.Width := 413;
ZoomButton.Caption := '시작 (S)';
Zoom.Active := false;
end;
end;
FilesDBUltimGrid.Width := MiniPaintMainForm.Width - 6;
for FieldCount := 0 to FilesDBUltimGrid.FieldCount - 1 do
if FilesDBUltimGrid.Columns[ FieldCount ].FieldName = 'mFile' then
FilesDBUltimGrid.Columns[ FieldCount ].Width := MiniPaintMainForm.Width - 230;
end;
procedure TMiniPaintMainForm.SizePopupPopup(Sender: TObject);
begin
GetCursorPos( PublicPoint );
if pMenu4.Checked then SetCursorPos( PublicPoint.X + 65, PublicPoint.Y + 35 )
else SetCursorPos( PublicPoint.X + 65, PublicPoint.Y + 15 );
if ImageSizeLED.Status then pMenu6.Checked := true
else pMenu6.Checked := false;
pMenu7.Checked := not pMenu6.Checked;
end;
procedure TMiniPaintMainForm.pMenu1Click(Sender: TObject);
begin
if Sender = pMenu1 then begin
PublicpMenu1Bool := true;
if ImageSizeLED.Status then OpenPicDlalig.Title := '그림판 크기, 그림판 기준으로 열기'
else OpenPicDlalig.Title := '그림판 크기, 이미지 기준으로 열기';
end else begin
PublicpMenu1Bool := false;
if ImageSizeLED.Status then OpenPicDlalig.Title := '이미지 크기, 그림판 기준으로 열기'
else OpenPicDlalig.Title := '이미지 크기, 이미지 기준으로 열기';
end;
SetCursorPos( PublicOpenPoint.X, PublicOpenPoint.Y );
if OpenPicDlalig.Execute then begin
FileName := OpenPicDlalig.FileName;
PictureFileOpen( Sender );
MemoryDBSave( FileName, '열기', Now );
end;
end;
procedure TMiniPaintMainForm.pMenu3Click(Sender: TObject);
begin
pMenu3.Checked := true;
pMenu4.Checked := false;
pMenu5.Checked := false;
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.pMenu4Click(Sender: TObject);
begin
pMenu3.Checked := false;
pMenu4.Checked := true;
pMenu5.Checked := false;
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.pMenu5Click(Sender: TObject);
begin
pMenu3.Checked := false;
pMenu4.Checked := false;
pMenu5.Checked := true;
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.pMenu6Click(Sender: TObject);
begin
pMenu6.Checked := true;
pMenu7.Checked := false;
ImageSizeLED.Status := true;
ImageSizeLED.Hint := '그림판 기준: Ctrl+U';
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.pMenu7Click(Sender: TObject);
begin
pMenu6.Checked := false;
pMenu7.Checked := true;
ImageSizeLED.Status := false;
ImageSizeLED.Hint := '이미지 기준: Ctrl+U';
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.pMenu8Click(Sender: TObject);
begin
pMenu8.Checked := not pMenu8.Checked;
MyImage.Proportional := pMenu8.Checked;
pMenuSetCursorPosPopup;
end;
procedure TMiniPaintMainForm.PenWidthComboBoxChange(Sender: TObject);
var PenWidth: Integer;
begin
PenWidth := MyPaintBox.Canvas.Pen.Width;
try
MyPaintBox.Canvas.Pen.Width := StrToint( PenWidthComboBox.Text );
except
PenWidthComboBox.Text := IntToStr( PenWidth );
MyPaintBox.Canvas.Pen.Width := PenWidth;
end;
end;
procedure TMiniPaintMainForm.InvertedCheckBoxClick(Sender: TObject);
begin
ControlsInitial( false, Sender );
end;
procedure TMiniPaintMainForm.ColorPanelColorChange(Sender: TObject);
begin
MyPaintBox.Canvas.Pen.Color := ColorPanel.SelectedColor;
end;
procedure TMiniPaintMainForm.RotateTimerTimer(Sender: TObject);
begin
if AboutButton.Images.ActiveIndex in [ 7 ] then AboutButton.Images.ActiveIndex := 0
else AboutButton.Images.ActiveIndex := AboutButton.Images.ActiveIndex + 1;
end;
procedure TMiniPaintMainForm.ImageSizeLEDClick(Sender: TObject);
begin
ImageSizeLED.Status := not ImageSizeLED.Status;
if ImageSizeLED.Status then ImageSizeLED.Hint := '그림판 기준: Ctrl+U'
else ImageSizeLED.Hint := '이미지 기준: Ctrl+U';
end;
procedure TMiniPaintMainForm.PenWidthComboBoxKeyPress(Sender: TObject; var Key: Char);
begin
if ( Key = #13 ) or ( Key = #27 ) then begin
Key := #0;
MainPanel.SetFocus;
end
end;
procedure TMiniPaintMainForm.AboutButtonClick(Sender: TObject);
begin
AboutForm := TAboutForm.Create( Self );
AboutForm.DoubleBuffered := true;
AboutForm.ShowModal;
end;
procedure TMiniPaintMainForm.ZoomComboBoxChange(Sender: TObject);
begin
Zoom.ZoomPercentage := StrToInt( ZoomComboBox.Text );
end;
procedure TMiniPaintMainForm.ZoomButtonClick(Sender: TObject);
begin
Zoom.Active := not Zoom.Active;
if not Zoom.Active then ZoomButton.Caption := '정지 (S)'
else begin
ZoomButton.Caption := '동작 (S)';
SetCursorPos( Mouse.CursorPos.X, Mouse.CursorPos.Y + 1 );
Zoom.Repaint;
SetCursorPos( Mouse.CursorPos.X, Mouse.CursorPos.Y - 1 );
end;
end;
procedure TMiniPaintMainForm.FilesButtonClick(Sender: TObject);
begin
if MiniPaintMainForm.Height > 400 then begin
MiniPaintMainForm.Height := FormHeight;
FilesButton.Images.ActiveIndex := 10;
MainPanel.SetFocus;
end else begin
MiniPaintMainForm.Height := FormHeight + 119;
FilesButton.Images.ActiveIndex := 11;
FilesDBUltimGrid.SetFocus;
end;
end;
procedure TMiniPaintMainForm.FilesDBUltimGridCellClick(Column: TColumn);
begin
with MemoryDB do begin
if RecordCount > 0 then begin
FileName := FieldByName( 'mFile' ).AsString;
if FieldByName( 'pMenu1' ).AsBoolean then PictureFileOpen( pMenu1 )
else PictureFileOpen( pMenu2 );
end;
end;
end;
procedure TMiniPaintMainForm.FilesDBUltimGridDblClick(Sender: TObject);
begin
MainPanel.SetFocus;
end;
procedure TMiniPaintMainForm.FilesDBUltimGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with TJvDBUltimGrid( Sender ) do begin
if Columns[ DataCol ].FieldName = 'mOpen' then begin
if Columns[ DataCol ].Field.Text = '열기' then Canvas.Font.Color := clYellow
else Canvas.Font.Color := clFuchsia;
end;
DefaultDrawColumnCell( Rect, DataCol, Column, State );
end;
end;
procedure TMiniPaintMainForm.FilesDBUltimGridKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_DELETE then begin
Key := 0;
with MemoryDB do begin
if ssCtrl in Shift then begin
DisableControls;
if RecordCount > 0 then begin
try
First;
while not Eof do begin
Edit;
Delete;
end;
except
Cancel;
end;
end;
EnableControls;
end else begin
if RecordCount > 0 then begin
try
Edit;
Delete;
except
Cancel;
end;
end;
end;
end;
end;
FilesDBUltimGridCellClick( nil );
end;
procedure TMiniPaintMainForm.SliderXChanged(Sender: TObject);
begin
PublicBitmap.Assign( MyImage.Picture );
if Sender = SliderX then begin
MainPanel.Width := SliderX.Position;
PublicBitmap.Width := MainPanel.Width;
SliderX.Hint := '넓이: ' + IntToStr( SliderX.Position );
end else begin
MainPanel.Height := SliderY.Position;
PublicBitmap.Height := MainPanel.Height;
SliderY.Hint := '높이: ' + IntToStr( SliderY.Position );
end;
MyImage.Picture.Bitmap.Assign( PublicBitmap );
SizePanel.Left := MainPanel.Width;
SizePanel.Top := MainPanel.Height;
FileNameChange;
end;
procedure TMiniPaintMainForm.SizePanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PublicSizeBool := true;
GetCursorPos( PublicSizePoint );
end;
procedure TMiniPaintMainForm.SizePanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if PublicSizeBool then begin
if ( SizePanel.Left + ( Mouse.CursorPos.X - PublicSizePoint.X ) ) <= 400 then begin
SizePanel.Left := SizePanel.Left + ( Mouse.CursorPos.X - PublicSizePoint.X );
PublicSizePoint.X := Mouse.CursorPos.X;
MainPanel.Width := SizePanel.Left;
SliderX.Position := MainPanel.Width;
FileNameChange;
end else SetCursorPos( PublicSizePoint.X, PublicSizePoint.Y );
if ( SizePanel.Top + ( Mouse.CursorPos.Y - PublicSizePoint.Y ) ) <= 220 then begin
SizePanel.Top := SizePanel.Top + ( Mouse.CursorPos.Y - PublicSizePoint.Y );
PublicSizePoint.Y := Mouse.CursorPos.Y;
MainPanel.Height := SizePanel.Top;
SliderY.Position := MainPanel.Height;
FileNameChange;
end else SetCursorPos( PublicSizePoint.X, PublicSizePoint.Y );
end;
end;
procedure TMiniPaintMainForm.SizePanelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if PublicSizeBool then begin
SliderXChanged( SliderX );
SliderXChanged( SliderY );
end;
PublicSizeBool := false;
end;
procedure TMiniPaintMainForm.TrayMenu1Click(Sender: TObject);
begin
MiniPaintTrayIconShowHide;
end;
procedure TMiniPaintMainForm.MiniPaintTrayIconClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button in [ mbLeft ] then MiniPaintTrayIconShowHide;
end;
end.
|