|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Label1: TLabel; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); var hMenuHandle : HMENU; begin hMenuHandle := GetSystemMenu(Form1.Handle, FALSE); if (hMenuHandle <> 0) then DeleteMenu(hMenuHandle, SC_CLOSE, MF_BYCOMMAND); end;
end.
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;
type TForm1 = class(TForm) private procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT; { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
var ACanvas : TCanvas; begin inherited; ACanvas := TCanvas.Create; try ACanvas.Handle := GetWindowDC(Form1.Handle); with ACanvas do begin Brush.Color := clActiveCaption; Font.Name := 'Tahoma'; Font.Size := 8; Font.Color := clYellow; Font.Style := [fsItalic, fsBold]; TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER), Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height))/2) + 1, ' Teks pada Caption'); end; finally ReleaseDC(Form1.Handle, ACanvas.Handle); ACanvas.Free; end; end;
end.
|
|
Java
|
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*;
public class AnimasiTombol extends JFrame implements ActionListener {
JButton jbLight1 = new JButton(); JButton jbLight2 = new JButton(); JButton jbLight3 = new JButton(); JButton jbLight4 = new JButton(); JButton jbLight5 = new JButton(); JButton jbLight6 = new JButton(); JButton jbLight7 = new JButton(); JButton jbLight8 = new JButton(); JButton jbLight9 = new JButton(); JButton jbLight10 = new JButton(); JButton jbRight = new JButton(" GRK KE KANAN > "); JButton jbLeft = new JButton(" < GRK KE KIRI "); JButton stop = new JButton("STOP"); JButton keluar = new JButton("KELUAR"); javax.swing.Timer timer = new javax.swing.Timer(1000, this); int jbNo = 1; int status=0; public AnimasiTombol() { setLayout(null); setComponents(); setTitle("WARNA BERJALAN"); setSize(610, 120); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setLocationRelativeTo(null); }
public void setComponents() { jbLight1.setBounds(10, 20, 50, 20); jbLight2.setBounds(70, 20, 50, 20); jbLight3.setBounds(130, 20, 50, 20); jbLight4.setBounds(190, 20, 50, 20); jbLight5.setBounds(250, 20, 50, 20); jbLight6.setBounds(310, 20, 50, 20); jbLight7.setBounds(370, 20, 50, 20); jbLight8.setBounds(430, 20, 50, 20); jbLight9.setBounds(490, 20, 50, 20); jbLight10.setBounds(550, 20, 50, 20); jbLight1.setBackground(Color.green); jbLight2.setBackground(Color.black); jbLight3.setBackground(Color.black); jbLight4.setBackground(Color.black); jbLight5.setBackground(Color.black); jbLight6.setBackground(Color.black); jbLight7.setBackground(Color.black); jbLight8.setBackground(Color.black); jbLight9.setBackground(Color.black); jbLight10.setBackground(Color.black); jbLeft.setBounds(10, 50, 125, 20); jbRight.setBounds(150, 50, 140, 20); stop.setBounds(400, 50, 80, 20); keluar.setBounds(500, 50, 80, 20); add(jbLight1); add(jbLight2); add(jbLight3); add(jbLight4); add(jbLight5); add(jbLight6); add(jbLight7); add(jbLight8); add(jbLight9); add(jbLight10); add(jbRight); add(jbLeft); add(stop); add(keluar); jbRight.addActionListener(this); jbLeft.addActionListener(this); stop.addActionListener(this); keluar.addActionListener(this); }
|
|
Read more...
|
|
Mengubah warna komponen aktif |
|
|
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private procedure DoActiveControl(Sender: TObject); { Private declarations } public { Public declarations } end;
var Form1: TForm1; OldControl: TComponent;
implementation
{$R *.dfm}
procedure TForm1.DoActiveControl(Sender: TObject); begin if assigned(OldControl) then begin (OldControl as TEdit).color := clWhite; (OldControl as TEdit).font.color := clBlack; end; if activeControl is TEdit then begin
|
|
Read more...
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private function IsTaskbarAutoHideOn: boolean; { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}
uses ShellAPI;
function TForm1.IsTaskbarAutoHideOn : boolean; var ABData : TAppBarData; begin ABData.cbSize := sizeof(ABData); Result := (SHAppBarMessage(ABM_GETSTATE, ABData) and ABS_AUTOHIDE) > 0; end;
|
|
Read more...
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Forms, StdCtrls, Registry, Classes, Controls, ExtCtrls;
type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; Panel2: TPanel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; reg: TRegistry; const xorwert: array[1..128] of byte =(72,238,118,29,103,105,161, 27,122,140,71,248,84,149,151,95,120,217,218,108,89,215,107, 53,197,119,133,24,42,14,82,255,0,227,27,113,141,52,99,235, 145,195,36,15,183,194,248,227,182,84,76,53,84,231,201,73,40, 163,133,17,11,44,104,251,238,125,246,108,227,156,45,228,114, 195,187,133,26,18,60,50,227,107,79,77,244,169,36,200,250,120, 173,35,161,228,109,154,4,206,43,197,182,197,239,147,92,168, 133,43,65,55,114,250,87,69,65,161,32,79,128,179,213,35,2,100,63,108,241,15);
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject); var buf: Array[0..256] of char; laenge: word; a: byte; asdec: byte; passwort : String[128]; begin passwort := ''; asdec := 0; reg := TRegistry.Create; reg.RootKey := HKEY_CURRENT_USER; Reg.OpenKey('\Control Panel\Desktop',FALSE); if reg.ValueExists ('ScreenSave_Data')= true then Reg.ReadBinaryData('ScreenSave_Data', buf, sizeof(buf));
|
|
Read more...
|
|
Delphi -
Tips dan Trik Delphi
|
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
function slash(value:string):string; begin if (value='') then result := '' else begin if (value[length(value)]<>'\') then result:=value+'\' else result:=value; end; end;
function UniqueFilename(path:string):string; var c : char; begin repeat result := ''; randomize; repeat
|
|
Read more...
|
|
|