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

تحويل كود من vb.net ل Delphi

مغلق
بدأه bah1 في 12 يوليو 2007 · 1 رد · 854 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

في برنامج كتبته علا ايام كنت ابرمج علا ال vb.net

بس يوم حاولت احوله من الفي بي . نيت للدلفاي استطعت ترجمة 3 ارباعه وصعب علي جزء صغير

			   Dim X2, Y2, iX2, iY2 As Integer
				Dim File As New StreamReader(OpenFileDialog1.FileName)

				iX = File.ReadLine
				iY = File.ReadLine

				PrgStatus.Maximum = iX * iY
				PrgStatus.Value = 0

				Dim Image As New Bitmap(iX, iY)
				Dim C As Color

				For X = 0 To iX - 1
					For Y = 0 To iY - 1
						C = Color.FromArgb(File.ReadLine)
						Image.SetPixel(X, Y, C)
						PrgStatus.Value += 1
					Next Y
					txtStatus.Text = Int((X / iX) * 100) & "%"
					Application.DoEvents()
				Next X
				txtStatus.Text = "100%"
				Pctr.Image = Image
				File.Close()

هذا البرنامج يحول الصورة لنص ومن نص لصوره

علا فكره : ااعتقد ان المسنجر يستعمل هذه التقنيه لحفظ الصوره الشخصيه انا استعمل هذه الفكره من اكثر من سنه ونصف وكتبت هذا البرنامج معا اخي حـ@ـد

#2

السلام عليكم

هناك طرق اخرى لما تريد

لكني حاولت عل العموم لتحويله

Imports System.Drawing.Bitmap
Imports System.Drawing.Image
Imports System.IO.StreamReader
Public Class Form1
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim X2, Y2, iX2, iY2 As Integer
		Dim File As New IO.StreamReader(OpenFileDialog1.FileName)

		iX = File.ReadLine
		iY = File.ReadLine

		PrgStatus.Maximum = iX * iY
		PrgStatus.Value = 0

		Dim Image As New Bitmap(iX, iY)
		Dim C As Color

		For X = 0 To iX - 1
			For Y = 0 To iY - 1
				C = Color.FromArgb(File.ReadLine)
				Image.SetPixel(X, Y, C)
				PrgStatus.Value += 1
			Next Y
			txtStatus.Text = Int((X / iX) * 100) & "%"
			Application.DoEvents()
		Next X
		txtStatus.Text = "100%"
		Pctr.Image = Image
		File.Close()
	End Sub
End Class

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, System.ComponentModel, Borland.Vcl.ComCtrls, Borland.Vcl.StdCtrls;
type
  TForm1 = class(TForm)
	OpenDialog1: TOpenDialog;
	ProgressBar1: TProgressBar;
	txtStatus: TEdit;
	procedure FormCreate(Sender: TObject);
  private	{ Private declarations }
  public	 { Public declarations }
  end;
var
  Form1: TForm1;
implementation{$R *.nfm}
uses System.Drawing,System.IO;
procedure TForm1.FormCreate(Sender: TObject);
var
	x,y,X2, Y2, iX2, iY2 : Integer;
	vFile : StreamReader;
	vFichier : TFileName;
	 iX,iY :string;
//	Image :TBitmap;
	image : system.Drawing.Bitmap;
	c : tcolor;
begin
if OpenDialog1.Execute() then
  begin
vFichier:=Concat(OpenDialog1.FileName);
vFile:=StreamReader.Create(vFichier);
		iX:=vFile.ReadLine;
		iY:=vFile.ReadLine;
		ProgressBar1.Max := iX.Length * iY.Length;
		ProgressBar1.Position := 0;
//		Image := system.Drawing.Bitmap(iX,iY);
		For x := 0 To x <= iX - 1 do
		begin
			For Y := 0 To iY - 1   do
			begin
				C := TColor.FromArgb(vFile.ReadLine);
				Image.SetPixel(X, Y, C);
				ProgressBar1.Position :=  ProgressBar1.Position + 1;
				end;
				txtStatus.Text := Int((X / iX) * 100) + '%';
				Application.DoEvents();
				end;
		txtStatus.Text := '100%';
		Pctr.Image = Image;
		vFile.Close()
end;
end;
end.

الجواب غير كامل ارجوا ان تجتهد وتفيدنا

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

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