loading...
مرجع مهندسی نرم افزار
آخرین ارسال های انجمن
حامد شیرزاد بازدید : 844 شنبه 21 آبان 1390 نظرات (0)
uses ShellAPI;
...
 
if ShellExecute(Form1.Handle, nil,
    'c:windowsgeneral.txt', nil, nil, SW_SHOW) <;= 32 then
  Application.MessageBox('Couldn''t execute the application',
    'Error', MB_ICONEXCLAMATION);
ShellExecute(Form1.Handle, nil, 'c:windowsnotepad.exe',
  'c:windowsgeneral.txt', nil, SW_SHOWMAXIMIZED);
ShellExecute(Form1.Handle, 'open', 'c:windowsnotepad.exe',
  'general.txt', 'c:windows', SW_SHOWNORMAL);
ShellExecute(Form1.Handle, nil, PChar(fname + '.txt'),
  nil, nil, SW_MAXIMIZE);
ShellExecute(Form1.Handle, nil, 'c:windowsnotepad.exe',
  nil, nil, SW_SHOWNORMAL);

 

حامد شیرزاد بازدید : 509 شنبه 21 آبان 1390 نظرات (0)

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Runtime.InteropServices;         
[DllImport("user32")]

internal static extern IntPtr GetDC(IntPtr hwnd);

[DllImport("User32.dll")]

internal static extern void ReleaseDC(IntPtr dc);

public void PaintRectangleToScreen()

{

IntPtr deskDC = GetDC(IntPtr.Zero);

Graphics g = Graphics.FromHdc(deskDC);

Font font = new Font("Arial Black", 36);

DrawStringOnCenter(g, "Sale 1387 mobarak!", font, new Point(0, -25));

font = new Font("Arial Black", 18);

DrawStringOnCenter(g, "by: Sinpin", font, new Point(0, 25));

Rectangle rect = new Rectangle(200, 300,

Screen.PrimaryScreen.Bounds.Width - 400,

Screen.PrimaryScreen.Bounds.Height - 600);

g.FillRectangle(new SolidBrush(Color.FromArgb(100, Color.DodgerBlue))

, rect);

g.DrawRectangle(new Pen(Color.DodgerBlue, 3), rect);

g.Dispose();

ReleaseDC(deskDC);

}

private void DrawStringOnCenter(Graphics g, string str, Font font, Point offset)

{

SizeF size = g.MeasureString(str, font);

g.DrawString(str, font, Brushes.White,

new PointF(

(Screen.PrimaryScreen.Bounds.Width - size.Width) / 2 + offset.X,

(Screen.PrimaryScreen.Bounds.Height - size.Height) / 2 + offset.Y)

);

}

و مثالی از طریقه ی استفاده :

private void Form1_Load(object sender, EventArgs e)

{

PaintRectangleToScreen();

this.Close();

حامد شیرزاد بازدید : 391 شنبه 21 آبان 1390 نظرات (0)
procedure TForm1.Button1Click(Sender: TObject); 
var 
N : Integer; //Counter 
TL,TT : Integer; //Backup for LEFT and TOP of teh FORM 
begin 
TL := Left; //Backups Left of the Form 
TT := Top; //Backups Top of the Form 
//********************************************************************* 
for N:=1 to 40 do begin //Counter Time 
Left:= (TL-10) + (Random(20)); {Shake Range in Horizontal Driection} 
Top := (TT-10) + (Random(20)); {Shake Range in Vertical Driection} 
end; 
//********************************************************************* 
Left := TL; //Restores Left of the Form 
Top := TT; //Restores Top of the Form 
end;

 

حامد شیرزاد بازدید : 468 شنبه 21 آبان 1390 نظرات (0)
 
// The point object 
TPointFill = class 
X : Integer; 
Y : Integer; 
end; 
// ---------------------------------------------------------------------------- 
// GetLinePoints 
// ---------------------------------------------------------------------------- 
function GetLinePoints(X1, Y1, X2, Y2 : Integer) : TList; 
var 
ChangeInX, ChangeInY, i, MinX, MinY, MaxX, MaxY, LineLength : Integer; 
ChangingX : Boolean; 
Point : TPointFill; 
ReturnList, ReversedList : TList; 
begin 
ReturnList := TList.Create; 
ReversedList := TList.Create; 
 
// Get the change in the X axis and the Max &; Min X values 
if X1 >; X2 then 
begin 
ChangeInX := X1 - X2; 
MaxX := X1; 
MinX := X2; 
end 
else 
begin 
ChangeInX := X2 - X1; 
MaxX := X2; 
MinX := X1; 
end; 
 
// Get the change in the Y axis and the Max &; Min Y values 
if Y1 >; Y2 then 
begin 
ChangeInY := Y1 - Y2; 
MaxY := Y1; 
MinY := Y2; 
end 
else 
begin 
ChangeInY := Y2 - Y1; 
MaxY := Y2; 
MinY := Y1; 
end; 
 
// Find out which axis has the greatest change 
if ChangeInX >; ChangeInY then 
begin 
LineLength := ChangeInX; 
ChangingX := True; 
end 
else 
begin 
LineLength := ChangeInY; 
ChangingX := false; 
end; 
// If the x's match then the line changes only on the Y axis 
if X1 = X2 then 
begin 
// Loop thru the points on the list, lowest to highest. 
for i := MinY to MaxY do 
begin 
Point := TPointFill.Create; 
Point.X := X1; 
Point.Y := i; 
ReturnList.Add(Point); 
end; 
// If the point was started on the right and went to the left then reverse the list. 
if Y1 >; Y2 then 
begin 
ReversedList := ReversePointOrder(ReturnList); 
ReturnList := ReversedList; 
end; 
end 
// If the x's match then the line changes only on the Y axis 
else if Y1 = Y2 then 
begin 
// Loop thru the points on the list, lowest to highest. 
for i := MinX to MaxX do 
begin 
Point := TPointFill.Create; 
Point.X := i; 
Point.Y := Y1; 
ReturnList.Add(Point); 
end; 
// If the point was started on the bottom and went to the top then reverse the list. 
if X1 >; X2 then 
begin 
ReversedList := ReversePointOrder(ReturnList); 
ReturnList := ReversedList; 
end; 
end 
// The line is on an angle 
else 
begin 
// Add the first point to the list. 
Point := TPointFill.Create; 
Point.X := X1; 
Point.Y := Y1; 
ReturnList.Add(Point); 
 
// Loop thru the longest axis 
for i := 1 to (LineLength - 1) do 
begin 
Point := TPointFill.Create; 
// If we are moving on the x axis then get the related Y point. 
if ChangingX then 
begin 
Point.y := Round((ChangeInY * i)/ChangeInX); 
Point.x := i; 
end 
// otherwise we are moving on the y axis so get the related X point. 
else 
begin 
Point.y := i; 
Point.x := Round((ChangeInX * i)/ChangeInY); 
end; 
// if y1 is smaller than y2 then we are moving in a Top to Bottom direction. 
// we need to add y1 to get the next y value. 
if Y1 <; Y2 then 
Point.y := Point.Y + Y1 
// otherwise we are moving in a Bottom to Top direction. 
// we need to subtract y1 to get the next y value. 
else 
Point.Y := Y1 - Point.Y; 
// if X1 is smaller than X2 then we are moving in a Left to Right direction 
// we need to add x1 to get the next x value 
if X1 <; X2 then 
Point.X := Point.X + X1 
// otherwise we are moving in a Right to Left direction 
// we need to subtract x1 to get the next x value. 
else 
Point.X := X1 - Point.X; 
ReturnList.Add(Point); 
end; 
// Add the second point to the list. 
Point := TPointFill.Create; 
Point.X := X2; 

تعداد صفحات : 46

درباره ما
به نام آنکه جان را فکرت آموخت در این وبلاگ سعی می شود به صورت تخصصی به مباحث مربوط به مهندسی نرم افزار به خصوص برنامه نویسی کامپیوتری پرداخته شود. مدیر وبلاگ : حامد شیرزاد
اطلاعات کاربری
  • فراموشی رمز عبور؟
  • آمار سایت
  • کل مطالب : 431
  • کل نظرات : 9
  • افراد آنلاین : 1
  • تعداد اعضا : 109
  • آی پی امروز : 184
  • آی پی دیروز : 72
  • بازدید امروز : 699
  • باردید دیروز : 81
  • گوگل امروز : 0
  • گوگل دیروز : 0
  • بازدید هفته : 1,030
  • بازدید ماه : 3,681
  • بازدید سال : 22,782
  • بازدید کلی : 791,310
  • کدهای اختصاصی

    قالب وبلاگ