|
OK, I read the original post wrong. Application.Exit() is what you should be using. If it's not working, then you've got something else wrong in your app that is preventing your app from closing.
How do you have your app processing command line arguments and printing your document? Are you doing this in the forms Load event? IIRC, calling Application.Exit() in the Load event doesn't do anything.
|
|
|
|
|
Thanks for your hint. During the form constructor, I detect if I have a command line argument listing the sheets to print and immediately proceed to handle it. This occurs before the main window is shown. I now set a flag that is tested during the form_Shown() handler and if I have printed sheets I call Application.Exit() as you recommended. Works like a charm
Again, thanks!
-Frank
|
|
|
|
|
OK - it's kind of the wacky way to go about it, but whatever works.
I'd normally create my own Main method, do whatever command line stuff I need to there and if I need to start the Windows Form app, branch off to the Application.Run(new MyMainForm). Other than that, let the Main method die normally.
|
|
|
|
|
i am completely new here, pls what is RedFive labs?
|
|
|
|
|
Enobong Adahada wrote: i am completely new here
Congrats
Enobong Adahada wrote: what is RedFive labs?
RedFive Labs[^]
Try Google more often.
[Edit]
Ok, I can tell you are new here.
Please check out the link at the top entitled 'how to get an answer to your question'.
People here will not do work for you based off your vague requirements, and even if you do state requirements properly chances are you still won't receive free work.
Please post specific problems that are part of your project, we won't start or finish it for you but we will help you along the way.
Please buy a book on the topic you wish to learn and begin studying/learning it. You cannot become a developer overnight.
[/Edit]
|
|
|
|
|
Ok, I have a control with custom painting being done. I have a back buffer bitmap that I draw to then OnPaint, I paint the entire bitmap to the control. There are sometimes with certain sections of the bitmap are updated and all I need to do is update those sections on the control. So what I'm doing so far is:
pseudocode
void UpdateArea(Rectangle rect)
{
Invalidate(rect);
}
void OnPaint(object o, PaintEventArgs e)
{
e.Graphics.DrawImage(BackBuffer, e.ClipRectangle, e.ClipRectangle, GraphicsUnit.Pixel);
}
Ok, that's not actual code, but it's close enough. When I call UpdateArea, the area which I changed is successfully reflected on the screen. However, once UpdateArea is called, the control will only redraw that section from there on out. Everything outside of the region becomes garbage. The Bitmap itself is fine because if I call Invalidate(), the entire bitmap draws just fine. What am I missing that would prevent the rest of the bitmap from being draw properly?
|
|
|
|
|
Hi,
I don't see anything wrong.
Are you sure you represented the actual code close enough?
or are you having some Graphics.Transforms you did not show?
tips for debugging:
- add logging (to file or to Console) to both UpdateArea and OnPaint; then check each rect that appears in UpdateArea
- create a second Panel ( or form or whatever) and inside the original OnPaint paint the entire bitmap to the entire second Panel, so you can see real-time whether your BackBuffer is still intact.
BTW: simplifying code shown may be a bad idea: something does not work the way you expect, what makes you think you can simplify your code reliably without hiding the problem?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Actually I just found my problem! When I go to call LockBits, I initially lock the entire bitmap, which apparently does something to the data. if I lock just the portion of the bitmap that I'm updating, all is fine and well.
|
|
|
|
|
Hi.
I'm using LINQ to SQL. I wanna create a database with LINQ but the following exception has occurred :
Illegal characters in path.
This is my code :
using (RezaRestaurant.SQL.DataClasses1DataContext dbc = new RezaRestaurant.SQL.DataClasses1DataContext())
if (!dbc.DatabaseExists())
dbc.CreateDatabase();
BTW : I was using UFT8 characters in database's tables, like this : اقلام_فروخته_شده
Could you please guide me ?
Thanks.
|
|
|
|
|
Illegal characters in path usually referrs to a file system path specification. Apparently, you're trying to check if a database exists in a certain place in the filesystem, but have built an illegal path specification.
|
|
|
|
|
Thanks Dave Kreskowiak.
So , How can I resolve it ?
|
|
|
|
|
Uhhh...make sure the path you built is legal?? What does the code look like that built the path you're using?
|
|
|
|
|
Dave Kreskowiak wrote: Uhhh...make sure the path you built is legal??
Well, I've tested it in root of D drive , but the exception has occurred again !
The database file (*.mdf) is beside of application's exe file in SQL folder.
With following code , I'm trying to create a new database.
public static string DBFolder = Application.StartupPath + "\\SQL\\";
private void MainForm_Load(object sender, EventArgs e)
{
if (!Directory.Exists(StaticVariables.DBFolder))
Directory.CreateDirectory(StaticVariables.DBFolder);
using (RezaRestaurant.SQL.DataClasses1DataContext dbc = new RezaRestaurant.SQL.DataClasses1DataContext())
if (!dbc.DatabaseExists())
dbc.CreateDatabase();
}
|
|
|
|
|
Youre code sure could use some work. I hate methods that don't take parameters when the name suggests they should.
The problem isn't in the first five lines you posted, up until the second if statement. So now you move on to the next lines. What does the code for dbc.DatabaseExists() and dbc.CreateDatabase() look like?
|
|
|
|
|
Hi,
I publish a setup with click one Installation,
and when i'm trying to install it i get:
application validation did not succeed.
What i'm doing wrong????
|
|
|
|
|
How are we supposed to answer? You have provided no details of what you have done or how you've done it.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: How are we supposed to answer? You have provided no details of what you have done or how you've done it.
I worket wxactly like this[]
Do you need more details?
|
|
|
|
|
i want to use a landscape setup in my c# crystal report app.
|
|
|
|
|
Ok, I can tell you are new here.
Please check out the link at the top entitled 'how to get an answer to your question'.
People here will not do work for you based off your vague requirements, and even if you do state requirements properly chances are you still won't receive free work.
Please post specific problems that are part of your project, we won't start or finish it for you but we will help you along the way.
Please buy a book on the topic you wish to learn and begin studying/learning it. You cannot become a developer overnight.
|
|
|
|
|
And I just want to have a million dollars.
|
|
|
|
|
i have multiple reports in my c# app. i want to view them all using a single report viewer (crystal reports)
|
|
|
|
|
Ok, I can tell you are new here.
Please check out the link at the top entitled 'how to get an answer to your question'.
People here will not do work for you based off your vague requirements, and even if you do state requirements properly chances are you still won't receive free work.
Please post specific problems that are part of your project, we won't start or finish it for you but we will help you along the way.
Please buy a book on the topic you wish to learn and begin studying/learning it. You cannot become a developer overnight.
|
|
|
|
|
Hi all,
Please can someone tell me how to start mobile apps.
i want to write a program to make calls using my pc, where do i start from.
i am new in this area.
|
|
|
|
|
First you need to understand and clarify what you want.
Enobong Adahada wrote: how to start mobile apps.
Enobong Adahada wrote: make calls using my pc
These are two separate environments
only two letters away from being an asset
|
|
|
|
|
Which mobiles? Mobile phones have an OS and not all will support your .net code. If you are aiming at Windows based mobiles, look in to .Net compact framework. There is a plenty of documentation about that on MSDN. If you are aiming at Symbian based mobiles, you can make .net application again and deploy them using RedFiveLabs.
Try out some basic stuff to begin with through the tutorials available.
As far as making calls from PC is concerned, I don't see much relation of that with Mobile development.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|