Font etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Font etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
8 Temmuz 2013 Pazartesi
C Sharp Form Uygulamalar Tam EkranEkran Koruyucu Yapma
KONU : C Sharp Uygulamalar ( C# ) form da dinamik grafik sınıfını kullanarak ekran koruyucu yapma, c# da ekran koruyucu yapmak, Grafik nesnesini kullanarak c sharp da ekran koruyucu yapmak
3 Haziran 2013 Pazartesi
C Sharp Uygulamalar Resource File Yazdırma - C Sharp Applications Print Resource Text Document
KONU : C Sharp Uygulamalar - C Sharp ( C# ) form uygulamalar resource eklenen gömülü dokümanı yazdırma.
ETİKETLER : c sharp printing - printing document in c sharp - direct printing c sharp - print document c# - print document - print document to file - print text file - print text - print text file in c# - c# print document - c# print text - c# print text file - csharp print dialog - csharp printdocument - csharp print document - c sharp print text file - c sharp print text - c sharp embedded file - c sharp print embedded text file
UYGULAMAYI İNDİR
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Printing;
using System.Reflection;
namespace PrintDocumentFile
{
public partial class Form1 : Form
{
OpenFileDialog openfiledialog;
StreamReader filereader;
PrintDocument printdocument;
PrintPreviewDialog printPreviewDialog;
Font ArialFont;
List fileLineList;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//dosyadan alınacak satırları tutacak bir liste oluştur
fileLineList = new List< string >();
// Create openfile dialog object.
openfiledialog = new OpenFileDialog();
openfiledialog.Title = "C Sharp Applications Open File Dialog";
openfiledialog.InitialDirectory = Application.StartupPath;
openfiledialog.Filter = "Text files (*.txt) | .txt | All files (*.*) | *.*";
openfiledialog.FilterIndex = 2;
openfiledialog.RestoreDirectory = true;
//Create a Arial font with size 12
ArialFont = new Font("Arial",12);
//Create a PrintDocument object
printdocument = new PrintDocument();
printPreviewDialog = new PrintPreviewDialog();
//Add PrintPage event handler
printdocument.PrintPage += new PrintPageEventHandler(printdocument_PrintPage);
printdocument.BeginPrint += new PrintEventHandler(printdocument_BeginPrint);
printdocument.EndPrint += new PrintEventHandler(printdocument_EndPrint);
}
void printdocument_EndPrint(object sender, PrintEventArgs e)
{
lblStatus.Text = "The document is printed ";
}
void printdocument_BeginPrint(object sender, PrintEventArgs e)
{
lblStatus.Text = "Printing is completed ";
}
private void btnPrint_Click(object sender, EventArgs e)
{
totalLinecount = 0;
//Call Print Method
printdocument.Print();
//Close the reader
if (filereader != null)
{
filereader.Close();
}
}
int totalLinecount = 0;
private void printdocument_PrintPage(object sender, PrintPageEventArgs printpageevent)
{
//Get the Graphics object from the print page event
Graphics g = printpageevent.Graphics;
float linesPerPage = 0;
float yposition = 0;
int pageLineCount = 0;
float leftMargin = printpageevent.MarginBounds.Left;
float topMargin = printpageevent.MarginBounds.Top;
//Calculate the lines per page on the basis of the height of the page and the height of the font
linesPerPage = printpageevent.MarginBounds.Height / ArialFont.GetHeight(g);
//Now read lines one by one, using StreamReader
while (pageLineCount < linesPerPage && totalLinecount < fileLineList.Count)
{
//Calculate the starting position
yposition = topMargin + (pageLineCount * ArialFont.GetHeight(g));
//Draw text
g.DrawString(fileLineList[totalLinecount], ArialFont, Brushes.Black, leftMargin, yposition, new StringFormat());
//Move to next line
totalLinecount++;
pageLineCount++;
}
//If PrintPageEventArgs has more pages to print
if (totalLinecount < fileLineList.Count)
{
printpageevent.HasMorePages = true;
}
else
{
printpageevent.HasMorePages = false;
}
}
private void btnBrowse_Click(object sender, EventArgs e)
{
if (openfiledialog.ShowDialog() == DialogResult.OK)
{
//okunan satırların saklanacağı listeyi temizle
fileLineList.Clear();
//textbox1 içinde açılan dosyanın adresini yazdıralım
textBox1.Text = openfiledialog.FileName;
string filename = textBox1.Text.ToString();
//Create a StreamReader object for reading file contents
filereader = new StreamReader(filename);
string satir;
while ((satir = filereader.ReadLine()) != null)
{
//dosyadan okunan satırları listeye ekleyelim
fileLineList.Add(satir);
}
}
}
private void btnOnizleme_Click(object sender, EventArgs e)
{
printPreviewDialog.Document = printdocument;
printPreviewDialog.ShowDialog();
}
private void btnResourceFilePrint_Click(object sender, EventArgs e)
{
totalLinecount = 0;
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("PrintDocumentFile.Resources.MyDocument.txt");
StreamReader reader = new StreamReader(stream);
string satir;
//okunan satırların saklanacağı listeyi temizle
fileLineList.Clear();
while ((satir = reader.ReadLine()) != null)
{
//dosyadan okunan satırları listeye ekleyelim
fileLineList.Add(satir);
}
//Call Print Method
printdocument.Print();
}
}
}

Etiketler:
Button
,
C#-Form
,
Float
,
Font
,
Generic List
,
Graphics
,
If
,
If-Else
,
Int
,
Label
,
OpenFileDialog
,
PrintDocument
,
PrintPreviewDialog
,
StreamReader
,
String
,
while
23 Mayıs 2013 Perşembe
C Sharp Uygulamalar Listbox Verilerini Yazdırma - C Sharp Applications Print Listbox Items
KONU : C Sharp Uygulamalar - C Sharp ( C# ) form uygulamalar listbox da bulunan verileri yazdırma.
ETİKETLER : c sharp printing - printing document in c sharp - direct printing c sharp - print document c# - print document - print document to file - print text file - print text - print text file in c# - c# print document - c# print text - c# print text file - csharp print dialog - csharp printdocument - csharp print document - c sharp print text file - c sharp print text - c sharp print listbox veriler - c sharp print listbox items - print listboxs data - print listbox
UYGULAMAYI İNDİR
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Printing;
namespace C_Sharp_Print_Listbox_Item
{
public partial class Form1 : Form
{
PrintPreviewDialog printPreviewDialog;
PrintDocument printDocument;
Font arialFont;
int counter = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Create print document object
printDocument = new PrintDocument();
//Create print priview dialog object
printPreviewDialog = new PrintPreviewDialog();
//Add PrintPage event handler
printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
printDocument.BeginPrint += new PrintEventHandler(printDocument_BeginPrint);
printDocument.EndPrint += new PrintEventHandler(printDocument_EndPrint);
//Create font object
arialFont = new Font("Arial", 12);
//fill listbox with numbers
for (int i = 0; i < 1000; i++)
{
listBox1.Items.Add(i);
}
}
private void btnPrint_Click(object sender, EventArgs e)
{
counter = 0;
printPreviewDialog.Document = printDocument;
printPreviewDialog.ShowDialog();
}
private void printDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
this.Text = "The document is printed";
}
private void printDocument_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
this.Text = "Printing is completed";
}
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs printpageevent)
{
//Get the Graphics object from the print page event
Graphics g = printpageevent.Graphics;
float linesPerPage = 0;
float yposition = 0;
int count = 0;
float leftMargin = printpageevent.MarginBounds.Left;
float topMargin = printpageevent.MarginBounds.Top;
string line = null;
//Calculate the lines per page on the basis of the height of the page and the height of the font
linesPerPage = printpageevent.MarginBounds.Height / arialFont.GetHeight(g);
//Now read lines one by one, using StreamReader
while (count < linesPerPage && counter < listBox1.Items.Count )
{
//get the line in listbox
line = listBox1.Items[counter++].ToString();
//Calculate the starting position
yposition = topMargin + (count * arialFont.GetHeight(g));
//Draw text
g.DrawString(line, arialFont, Brushes.Black, leftMargin, yposition, new StringFormat());
//Move to next line
count++;
}
//If PrintPageEventArgs has more pages to print
if (line != null)
{
printpageevent.HasMorePages = true;
}
else
{
printpageevent.HasMorePages = false;
}
}
}
}

C Sharp Uygulamalar Doküman Yazdırma - C Sharp Applications Print Text Document
KONU : C Sharp Uygulamalar - C Sharp ( C# ) form uygulamalar bir dokümanı yazdırma.
ETİKETLER : c sharp printing - printing document in c sharp - direct printing c sharp - print document c# - print document - print document to file - print text file - print text - print text file in c# - c# print document - c# print text - c# print text file - csharp print dialog - csharp printdocument - csharp print document - c sharp print text file - c sharp print text
UYGULAMAYI İNDİR
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Printing;
namespace PrintDocumentFile
{
public partial class Form1 : Form
{
OpenFileDialog openfiledialog;
StreamReader filereader;
PrintDocument printdocument;
Font ArialFont;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Create openfile dialog object.
openfiledialog = new OpenFileDialog();
openfiledialog.Title = "C Sharp Applications Open File Dialog";
openfiledialog.InitialDirectory = Application.StartupPath;
openfiledialog.Filter = "Text files (*.txt) | .txt | All files (*.*) | *.*";
openfiledialog.FilterIndex = 2;
openfiledialog.RestoreDirectory = true;
//Create a Arial font with size 12
ArialFont = new Font("Arial",12);
//Create a PrintDocument object
printdocument = new PrintDocument();
//Add PrintPage event handler
printdocument.PrintPage += new PrintPageEventHandler(printdocument_PrintPage);
printdocument.BeginPrint += new PrintEventHandler(printdocument_BeginPrint);
printdocument.EndPrint += new PrintEventHandler(printdocument_EndPrint);
}
void printdocument_EndPrint(object sender, PrintEventArgs e)
{
lblStatus.Text = "The document is printed ";
}
void printdocument_BeginPrint(object sender, PrintEventArgs e)
{
lblStatus.Text = "Printing is completed ";
}
private void btnPrint_Click(object sender, EventArgs e)
{
//Call Print Method
printdocument.Print();
//Close the reader
if (filereader != null)
{
filereader.Close();
}
}
private void printdocument_PrintPage(object sender, PrintPageEventArgs printpageevent)
{
//Get the Graphics object from the print page event
Graphics g = printpageevent.Graphics;
float linesPerPage = 0;
float yposition = 0;
int count = 0;
float leftMargin = printpageevent.MarginBounds.Left;
float topMargin = printpageevent.MarginBounds.Top;
string line = null;
//Calculate the lines per page on the basis of the height of the page and the height of the font
linesPerPage = printpageevent.MarginBounds.Height / ArialFont.GetHeight(g);
//Now read lines one by one, using StreamReader
while (count < linesPerPage && ((line = filereader.ReadLine()) != null))
{
//Calculate the starting position
yposition = topMargin + (count * ArialFont.GetHeight(g));
//Draw text
g.DrawString(line, ArialFont, Brushes.Black, leftMargin, yposition, new StringFormat());
//Move to next line
count++;
}
//If PrintPageEventArgs has more pages to print
if (line != null)
{
printpageevent.HasMorePages = true;
}
else
{
printpageevent.HasMorePages = false;
}
}
private void btnBrowse_Click(object sender, EventArgs e)
{
if (openfiledialog.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openfiledialog.FileName;
string filename = textBox1.Text.ToString();
//Create a StreamReader object for reading file contents
filereader = new StreamReader(filename);
}
}
private void button1_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printdocument;
printPreviewDialog1.ShowDialog();
}
}
}

Kaydol:
Kayıtlar
(
Atom
)