Click here to Skip to main content
15,890,438 members

Comments by Member 15028314 (Top 21 by date)

Member 15028314 1-Dec-22 13:08pm View    
The function: RegCreateAddSetString, is a user built function. This function creates the item and fills it with a value.
Member 15028314 8-Aug-22 19:31pm View    
I've put together a "C" routine that builds a nice sized calendar with some features while writing it to a text file.
When completed, I edited the file just to look at it via MS-Notepad and it looked like garbage. Then I printed
it via MS-Notepad and it resulted in printed garbage. BUT when using NOTEPAD++ editor to look at them, the
calendars retained their shapes and forms, and then I printed them out using NOTEPAD++, their results were
spectacular. Included below is some C# printer code that I'm using to print out these text files, but their results
were garbage, they don't hold their form. How can this C# printer code be doctored/modified up to
perform/PRINT like NOTEPAD++, which produces some excellent results. The results being some excellent
calendar forms.

Any help would be appreciated. Again Thanks.
Aug 8, 2022
Member 15028314 - McGruff.
-----------------------
private void printbutton1_Click(object sender, EventArgs e)
{
int ierrcode;
errorline4.Text = "";
ierrcode = 0;
dofileactivitys( out ierrcode); //// pulling some edits.
if (ierrcode != 0)
{ //// the error section.
/// display an error message here.......
errorline4.Text = " Error Encountered in printing operations. ";
}
else
{
string filename;
filename = gstring;
Console.WriteLine(" *File: " + filename);
///Create a StreamReader object
reader = new StreamReader(filename);
///Create a Verdana font with size 10
verdana10Font = new Font("Verdana", 10);

///Create a PrintDocument object
PrintDocument pd = new PrintDocument();
///Add PrintPage event handler
pd.PrintPage += new PrintPageEventHandler(this.PrintTextFileHandler);
///Call Print Method
pd.Print();
///Close the reader
if (reader != null)
{
reader.Close();
}
}
}
private void PrintTextFileHandler(object sender, PrintPageEventArgs ppeArgs)
{
//Get the Graphics object
Graphics g = ppeArgs.Graphics;
float linesPerPage = 0;
float yPos = 0;
int count = 0;
//Read margins from PrintPageEventArgs
float leftMargin = ppeArgs.MarginBounds.Left;
float topMargin = ppeArgs.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 = ppeArgs.MarginBounds.Height / verdana10Font.GetHeight(g);
//Now read lines one by one, using StreamReader
while (count < linesPerPage && ((line = reader.ReadLine()) != null))
{
//Calculate the starting position
yPos = topMargin + (count * verdana10Font.GetHeight(g));
//Draw text
g.DrawString(line, verdana10Font, Brushes.Black, leftMargin, yPos, new StringFormat());
//Move to next line
count++;
}
//If PrintPageEventArgs has more pages to print
if (line != null)
{
ppeArgs.HasMorePages = true;
}
else
{
ppeArgs.HasMorePages = false;
}
}
------------------------------
Member 15028314 19-Jul-22 14:11pm View    
Hello OriginalGriff, I figured out my problem via my son, but I do not understand the answer why. My son told me to use notepad++, not MS-notepad, to see the actual calendar in month-form. I could see the month -calendars perfectly that I sent to a text file. And so I printed out a couple of months of the year, from notepad++, not MS-notepad. The output of NOTEPAD++ was excellent. Can you figure out why OriginalGriff?? And Thanks again...
Member 15028314 30-Jun-22 21:44pm View    
Hello OriginalGriff, it's been a long time since I have communicated with you. The problem I've been having is contained in a completed project(function). It is a small calendar that I blew up to a big size and added a few nice features to it. Of doing all of the programs that I am currently working, I have learned a lot on my own. I maybe soon sending the function to Patrica T., if she responds right.
Member 15028314 30-Jun-22 21:37pm View    
send me an quiet/not-known email address and I'll send you the code, but don't make the email known. Ok. I'm not one whom sends out their hard work to people to browse. But I'll do it. It was an idea I acquired off the Internet, and then I blew it up to its size, and added function call of my own to add features to it.