|
Think of each string of text as an object that needs to be drawn on the page. Each object needs to supply certain things to your drawing engine. The first, obvisouly, is the text that needs to be drawn. You also need to know where on the page the text needs to be drawn and in what font, style, and size. In your OnPrintPage event handler, the code needs to enumerate the collection of these objects and draw each string at the position where it needs to be and with the correct font.
To use something like this, you'd probably do something like:
ReceiptPrint receipt = new ReceiptPrint();
receipt.AddDrawCommand(new TextDrawCommand("Some Store Header Text", "Arial", 16, FontStyle.Bold));
receipt.AddDrawCommand(new TextDrawCommand("Some Address Text", "Courier New", 10, FontStyle.Normal));
receipt.AddDrawCommand(new TextDrawCommand("------------------------", "Courier New", 10, FontStyle.Normal));
foreach(...)
receipt.AddDrawCommand(new TextDrawCommand(ItemText, "Arial", 10, FontStyle.Normal));
receipt.Print();
|
|
|
|
|
Ok, I understand what you are saying (It is similar to what I was trying to do earlier this morning), but I am unsure as to how I would go about the method you're suggesting. It was inside my class that I couldn't quite get the collection correct. I wasn't sure as to how I would set the object (string, font) and pass the object to the DrawString by looping through the collection.
|
|
|
|
|
Any one have a suggestion / idea / recommendation as to how (Or where I can research) a solution?
|
|
|
|
|
Can someone point me in a direction as to how to resolve this? I have been scouring the internet for hours trying too many things that aren't working completely.
Thank you,
James
|
|
|
|
|
I've Created one Desktop Application which has server client access... Every user will has different login. Now the problem is, when one user is login, the same user cannot be login from other pc... The msg should come as the 'user is already Login'. In ASP.Net, it can be achieved through session.. But, how can I do this in Desktop Application. There is one solution.. We can maintain one log table for the logined users. But, that too will face deadlock situation.... Is any other solution for the single user login??
|
|
|
|
|
Shalini_U wrote: I've Created one Desktop Application which has server client access
When you say server/client access, do you mean you have both a server app and a client app? if so, then the server app will easily be able to keep a list of logged in users and validate the login.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Deadlock Situation may occur na?? ? Then, any user could not log in again
|
|
|
|
|
That depends on what you mean by "deadlock situation". I can't think of an issue that can't easily be resolved in a setup liek this.
|
|
|
|
|
When the server app validates login can it not check if existing user connection is still active?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
If anybody have an idea to upload quote data(in .CSV format) from c# application to Amibroker chart application.
|
|
|
|
|
Hello Ladies and Gentleman,
I have a problem with the DataTableColumn.AutoIncrementSeed value.
I am loading a set of Tables from my SQL Server DB to a DataSet by using SqlDataAdapter Fill method (I am using the MissingSchemaAction.AddWithKey property).
So I have a master detail scenario in my DataSet with 3 different tables, PrimaryKeys (all with autoincrement = true) and ForeignKeys.
The Problem is, when I insert new rows into the DataTables I want them to have ID's starting from -1 with an AutoIncrementStep = -1. The AutoIncrementStep is working fine.
Nevertheless I can not change the AutoIncrementSeed Even if I set its value to -1 (I checked in the debugger, the value is -1), after adding a new row, the seed starts at the last ID's value read from the DataBase while filling the DataTables. Am I missing something, or is this just impossible to change?
I would be really grateful for help.
Greets,
Arek
|
|
|
|
|
Hi,
To add auto increment column in the DataTable, we can set the AutoIncrement property of the DataColumn object as true and specify the seed value after adding that field into the DataTable object.
// create columns for the DataTable
DataTable dTable = new DataTable();
DataColumn auto = new DataColumn("AutoID", typeof(System.Int32));
dTable.Columns.Add(auto);
// specify it as auto increment field
auto.AutoIncrement = true;
auto.AutoIncrementSeed = 1;
auto.ReadOnly = true;
|
|
|
|
|
Hi S.Dhanasekaran
thank you for your reply, I really appreciate.
Why do I have to create a DataColumn by myself? When I use SQLDataAdapter Fill() method, it does the same for me.
After using the Fill method of the SQLDataAdapter I do sth like this:
dataS = new DataSet();
...
dataS.Tables.Add(dataTable);
dataS.Tables["MyTable"].Columns["MyID"].AutoIncrement = true;
dataS.Tables["MyTable"].Columns["MyID"].AutoIncrementStep = -1;
dataS.Tables["MyTable"].Columns["MyID"].AutoIncrementSeed = 0;
dataS.Tables["MyTable"].Columns["MyID"].AutoIncrement = true;
dataS.Tables["MyTable"].Columns["MyID"].ReadOnly = true;
When i check the debugger, the AutoIncrementSeed is "-1" and the AutoIncrementStep is also "-1".
But for example, when I have now 4 rows with MyIDs = {1, 2, 3, 4} and I add manually a new row to the DataSet, the value of MyID should be -1, but it is 3.
And I have completely no clue why is that
|
|
|
|
|
You cannot use negative numbers as the autoincrement value. Negative numbers are used by the DataAdpaters to add new records to the dataset that haven't been added to the backing database yet. The first new record you add will have an ID of -1, the next new record will be -2, and so on. Those are the temporary values used to uniquely identify each new record. They will get actual IDs once the changes are written to the database.
|
|
|
|
|
Hi Dave,
thanks for you reply.
Exactly that is what I want to achieve. I don't know the real ID values of the rows before I don't insert them to the Database. So in my case new DataTable rows are temporary and I want them to have negative ID (PrimaryKey) numbers. After I make an insert to the Database, they will receive the identity values from Database tables.
The step is negative and if I add enough rows it also gets negative, but it always starts from the last rows ID value, though I set the increment seed value to "0".
|
|
|
|
|
hi all,
what is the Difference between Button and Command button in .net
if anybody knows please reply me
Thanks in advance.
Raaj
|
|
|
|
|
Hi,
does this help you?
"The CommandButton control in Visual Basic 6.0 is replaced by the Windows Forms Button control in Visual Basic .NET"
It's from: link[^]
bye
|
|
|
|
|
|
I don't get the question. Do you mean how do you set an icon ? You create an icon file that has icons in all the sizes you need, and point to it in your project settings. Then any shortcut will have the right icon.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I guess you want to set Icon to your Exe.
One your Solution in Visaul Studio > Project Menu > Project Properties > In Application Tab : There is an Icon and Manifest Section.
Select the Icon >Save It > Build your application again > Check the Exe Icon
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hey... don't delete the message, if it solved, then marked it as solved.
|
|
|
|
|
Hi,
How to apply css to any controls placed inside a winform of my c# page.
|
|
|
|
|
Sorry, it can't be done.
But check out this article anyway: link[^]
|
|
|
|
|
CSS doesn't apply to Windows Forms applications at all.
|
|
|
|
|
Hi! I m a learner. What part of the code (no matter wherever in the code) acts to INTER RELATE the participating files & pages in a C# project. eg: if I add a file named new.cs to an existing project, what makes new.cs or existing files in the project know that a new comer just joined the project. Thanx
|
|
|
|