|
Hello,
I have an instance of System.Drawing.Bitmap that I whant to send to a defined Printer.
No idea how to do that.
If its only possible over a file, I would use the Bitmap.Save() Method to save it somewhere temp.
But I would prevere a solution without saving to a file.
I get the printers out of the System.Drawing.Printing.PrinterSettings.InstalledPrinters.
I looked into namespace System.Drawing.Printing, too following classes:
PrinterSettings (Here I could set the printer name)
PrintDocument (There is a Print() Method)
But I have no idea how too tell the PrintDocument which file or better Bitmap, too print.
Best solution for me would be without DialogBoxes. (No interaction for the user)
I would really be thankfull for your help.
Martin
|
|
|
|
|
Hi,
you are principally working with the correct classes. If you have configured yor PrintDocument and PrinterSettings with all required settings than call Print() on the PrintDocument. It will raise a PrintPage event. You'll have to catch this. The event arguments provide a Graphics object where you can draw your bitmap into.
Robert
|
|
|
|
|
OOOOOOOOOh,
I found such a solution somewhere, but didn't whant too believe that after the event was fired, I could change some data.
I will try it now and tell you what happens.
Thank you very much for helping so fast..
Martin
|
|
|
|
|
Thank you again Robert.
It works fine!
I used:
e.Graphics.DrawImage(Bitmap,0,0);
for the conversion.
Hope this is the recomended way to do it.
All the best,
Martin
|
|
|
|
|
Hello...
It seems Label.TextAlign doesn't work anymore in VS2005.
I just put a label at the right side of my form and set TextAlign to MiddleRight. Then I just write something long, for example "ABCDEFGHIJKL...".
The label grows not to left, but to right. I try to set the size using property window, it doesn't work also. The size seems to be set automatically.
Has anybody any solution for this ?
Thanks...
|
|
|
|
|
Hi,
I think the different behaviour comes from the fact that in VS2005 the AutoSize property is by default set to true and not like in VS2003 to false.
Robert
|
|
|
|
|
Hi All,
I am Working in C#.Net Technology (Window Based Application).My Problem is that ,I Want to display a Image in DataGridView cell.Iam able to display different Images In different cell of particular Column,But my problem is that Iam getting the image of a Exact Size.What I wan is to Scale a Image so that Whole Iamge is Visible In a Small Size not a Part Of it.
Can any body guide me .
Rahul Joshi
|
|
|
|
|
Hi,
I assume you are using a DataGridViewImageColumn. It has a ImageLayout property where you can set the resizing behaviour.
Robert
|
|
|
|
|
Hi Robert,
Thanks for replying
But Sorry to say It's not working in the Desire way.
( ColumnName.ImageLayout = DataGridViewImageCellLayout.Stretch;)
Rahul Joshi
|
|
|
|
|
I am trying to get a reference to an object by its name (string). Can we do this in C#. Please help.
Object objA = new object();
I wanna get reference to objA, by saying something like GetReference("objA")
|
|
|
|
|
You can do this with reflection. It's complicated, and expensive. Why do you want to do this ? Where is objA, that you have to go looking for it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
there must be a better way of doing this.
If you explain what you are trying to do maybe we could help more.
russ
|
|
|
|
|
I am trying to get a reference to an object by its name (string). Can we do this in C#. Please help.
Object objA = new object();
I wanna get reference to objA, by saying something like GetReference("objA")
|
|
|
|
|
Please don't double post.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You've stepped through and it loops twice over the one object ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
I have a question. How to grab data from datagrid (which is from Oracle database) and I want to store this data to MYSQL database. COuld anyone help me with this problem. FYI, I'm developing web application.
Thanks
Nasyiqin
|
|
|
|
|
hi,
i have a windows application and i wish the program to start as a full screen application even above the start menu. if any one knows how to do that please let me know.
Thanks in advance
jamil abou khalil
|
|
|
|
|
You just move your window so the frame is outside the visible area. You can also set your frame type to not have one, if you prefer.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi,
thanks for you reply but i am sorry, i couldn't understand what u are trying to tell me. if you please elaborate a little.
You just move your window so the frame is outside the visible area.
why should i move the window so that it is not visible. i need it to be full screen.
best regards
Jamil abou khalil
|
|
|
|
|
*sigh* The frame is all around the edges of your window. If the top of the frame is *above* the top of your window, the left frame is past the left edge of your window, etc, then your app will appear full screen, right ?
Christian Graus - C++ MVP
|
|
|
|
|
sorry man i am not understanding what u are trying to tell me.
Let us make it a simple question. Is there any code or instruction that makes the frame appear as a full screen application not a maximized application
thanks
Jamil Abou Khalil
|
|
|
|
|
jamil abou khalil wrote: sorry man i am not understanding what u are trying to tell me
I have no idea how to make it more simple.
jamil abou khalil wrote: Is there any code or instruction that makes the frame appear as a full screen application not a maximized application
Like I said in the first instance, you can set the app to not have a frame. That is a single line in .NET, but in MFC, we used to do what I've been trying to explain to you.
You can set FormBorderStyle to None.
Christian Graus - C++ MVP
|
|
|
|
|
Thnaks man It worked now
Jamil Abou Khalil
|
|
|
|
|
Hi,
set the FormBorderStyle of your Form to None and set WindowState to Maximized. Moreover you could set TopMost to true to ensure no other window gets in front of it (doesn't always work - e.g. the TaskManager is always on top of everything else).
Robert
|
|
|
|
|
hi,
you can use this code:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
if not this effect ,please remove the first code
|
|
|
|