الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤال بسيط جدا

مغلق
بدأه اتجاهات في 11 فبراير 2005 · 8 رد · 620 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

اخواني المبرمجين المحترفين المحترمين وفقكم الله واشكر الجميع على التجاوب مسبقا

لدي تسائلان :-

1- اريد جعل كلمة السر في ملف خارجي بحيث لا تكون في جدول ضمن قاعدة البيانات ليتمكن اي شخص من تعديلها فهل يمكن ذلك وكيف ارجو ارفاق مثال على ذلك وفقكم الله

2- اخي Justnick وفقك الله هل يمكن تطبيق فكرة تغييرالفونت بنفس الكود الذي ارفقته بخصوص ini color وكيف حيث انني حاولة التجريب و التغيير ولكن دون جدوى

#2

حاضر سوف اقوم بالتجربة واعديلك الطريقة لكى نتعلمها سويا انا وانت

{ربى زدنى علما}

#3

مشكور اخوي وعودتنا منك الجميل وسرعة الرد بارك الله لك في علمك وعمرك

وزادنا واياك من فضله

نحن بالانتظار

#4

:rolleyes: السلام عليكم ورحمة الله وبركاته

تحية طيبة وبعد

اليك ما توصلت اليه حتى الان وهو حفظ نوع الخط وحجمه وكنت اتمنى ان اتيك بالStyle ايضا ولكن قريبا ان شاء اله

اول قم بفتح مشروه جديد

واستعمل الكود التالى

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,INIFILES, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    FontDialog1: TFontDialog;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
IF FontDialog1.Execute then  //excute Font dialog
begin
Form1.Font:=FontDialog1.Font;//change form font
end;
end;
 //------Save Font in ini File-----
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var myini:TIniFile;
begin
myini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');
with myini do begin
WriteString('Form','Font',string(Form1.Font.Name));//Write Font Name

 WriteInteger('Form','FontSize',form1.Font.Size);//Write Font Size
end;
myini.Free;//Free
  end;

  //----Load Form Font from ini ----
procedure TForm1.FormCreate(Sender: TObject);
var
Fontsize:integer;
FontName:string;
myini:TIniFile;
begin
myini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');
with myini do begin
FontName:=ReadString('Form','Font','MS Sans Serif');//MS Sans Serif is defualt set
Fontsize:=ReadInteger('Form','FontSize',8); //font size defualt
end;
 Form1.Font.Name:=FontName; //Apply
 form1.Font.Size:=Fontsize;
 myini.Free;

end;

//************************************
//Coded By JustNick
//Good Luck
end.

مع خالص حبى واحترامى لك وشكرا

FontIni.zip

{ربى زدنى علما}

#5

:rolleyes: السلام عليكم اليك كل ما يتعلق بحفظ الخط ولون الخط وستيل الخط

ارجو ان ينال اعجابك هذا الكود يمكنك تجاهل المشاركة السابقة تماما حيث ان هذه المشاركة بها كل شئ

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,INIFILES, StdCtrls;
type
  pFontStyles = ^TFontStyles;
pInteger = ^integer;
type
  TForm1 = class(TForm)

    Button1: TButton;
    FontDialog1: TFontDialog;
    Edit1: TEdit;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    Function  FontStyleToInteger(Const fStyle :TFontStyles):integer;
    Function  IntegerToFontstyle(const value : integer):TFontStyles;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
IF FontDialog1.Execute then  //excute Font dialog
begin
Form1.Font:=FontDialog1.Font;//change form font
end;
end;
//--------FontStyleToInt-----------
function TForm1.FontStyleToInteger(const fStyle: TFontStyles): integer;
begin
Result:=pInteger(@fStyle)^;
end;
 //------Save Font in ini File-----
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var myini:TIniFile;
begin
myini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');
with myini do begin
WriteString('Form','Font',string(Form1.Font.Name));//Store Font Name
 WriteInteger('Form','FontSize',form1.Font.Size);//Store Font Size
 WriteInteger('Form','FontStyle',FontStyleToInteger(form1.font.style));//Store Font Style
WriteInteger('Form','FontColor',form1.Font.Color); //store Font Color
 end;
myini.Free;//Free
  end;

  //----Load Form Font from ini ----
procedure TForm1.FormCreate(Sender: TObject);
var
Fontsize,FontStyle,FontColor:integer;
FontName:string;
myini:TIniFile;
begin
myini:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'myini.ini');
with myini do begin
FontName:=ReadString('Form','Font','MS Sans Serif');//MS Sans Serif is defualt set
Fontsize:=ReadInteger('Form','FontSize',8); //font size defualt
FontStyle:=ReadInteger('Form','FontStyle',0);//Font Style read
FontColor:=ReadInteger( 'Form','FontColor',form1.Font.Color);
end;
 Form1.Font.Name:=FontName; //Apply
 form1.Font.Size:=Fontsize;
 Form1.Font.Style:=IntegerToFontstyle(FontStyle);
 Form1.Font.Color:=FontColor;
 myini.Free;  //free

end;
//---------IntToFontStyle-----
function TForm1.IntegerToFontstyle(const value: integer): TFontStyles;
begin
result:=pFontStyles(@value)^;
end;

end.
//************************************
//Coded By JustNick
//Ahmed Shoulah ...
//Good Luck

وشكرا والسلام عليكم ورحمة الله وبركاته

FontIni.zip

{ربى زدنى علما}

#6

لك خالص الشكر اخوي Justnick وعاجز عن شكرك

وفقك الله

طلب بسيط هل ممكن بريدكم الالكتروني وفقكم الله

والسلام عليكم و رحمة الله وبركاته

#7

ممكن ولكن كيف ارسله لك هل ممكن ان اكتبه داخل المنتدى بطريقة عادية هل هذا لا يخالف التعليمات؟

{ربى زدنى علما}

#8

لا اعلم هل المنتدى يمنع ظهور البريد على الصفحات ام ماذا؟؟!

لك خالص شكري

#9

ولك ايضا

{ربى زدنى علما}

هذا الموضوع مغلق.

مواضيع مشابهة