|
Just wanted to leave a paper trail here on this subject in case someone else attempts it.
I had my first level of success this morning. I used the one dudes idea of image processing first, then OCR the document.
So I fiddled with Photoshop and tried about 20 different things with just getting a little better result. Then I went back my photography days to sharpen images and tried a few of those techniques. The best result came from auto contrasting the image to pure black and white and then using Unshape Mask at Max values to exaggerate the dot matrix printing into a filled in character.
All the Dot Matrix translated very well along with the pre-printed stuff on the form using the Microsoft Windows 10 OCR and my Test App written in C# Winforms. The IronOcr in 3 different modes wasn't able to read the image and got worst. But I'll play around with the settings some more.
So I'm thinking I'll head down this road first. Consider a scanner, image processing and OCR before I start messing with printer escape codes, or changing the printing system all together.
Perhaps I should of looked for image packages on Nuget first before I wrote this. Hope it doesn't turn into a C++ thing. But I don't think I'll have to spend $1K to $6K for an OCR solution. Maybe this is what OCR solution do in the first place.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Good morning folks,
I've created an image to use as a splash screen for my application, I've tried using this in two ways:
1) Added as a background image to a from at design time with a layout of none.
2) Added a picture box and then assigned the image with a size mode of normal.
In both instances the image displays correctly at design time but then grows by about 20% at run time.
I know I can change the layout/size mode to correct for this but the image goes from lovely and crisp to all blurry.
Can anyone suggest what is going wrong here please?
I'm assuming it is something to do with a miss match of size units between pixels and em etc but I'm struggling to find anything at all.
Apologies I've not really got any code to show as its been created at design time and not coded.
The IDE being used is visualstudio express 2015
|
|
|
|
|
Take a look at the source code in the designer module, which will have the same name as your main form, with an extension of .Designer.cs . That will show you all the details of the generated code. Alternatively you can look at the properties of your image to see that it fits correctly into the form.
|
|
|
|
|
Thanks for your reply Richard.
I think I've just discovered this is something to do with Windows 10, it scales apps by 150% by default for some reason. Visual studio appears to have been fighting with this.
|
|
|
|
|
|
i have been trying to get my program to start but it keeps refusing to.can anyone help me find a solution to the error below.thanks
This site can’t be reached localhost refused to connect.
Search Google for localhost 58962
ERR_CONNECTION_REFUSED
|
|
|
|
|
|
I have tried a lot of them but I keep getting the same thing
|
|
|
|
|
I've recently had these too, is it for a CDN URL, i.e. JQuery, Angular etc? if so check your firewall to ensure that it isn't blocked.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Try to open properties of project..
Change port number.
like this
Or use IIS to attach your web folder instead of using IIS Express.
Regards
Toha
|
|
|
|
|
You have already posted this in the ASP.NET forum, which was the correct place to post it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You must only check all source code.
|
|
|
|
|
I'm programming in C# using Visual Studio Express 2005 and my application has a regular WinForms form, which I will refer to as "main form". From this form I create another non-modal form, which I will refer to as "secondary form". I usually have a lot of different application running on my computer and sometimes I want to easily bring the main form to the front from the secondary form. So, in my secondary form I have a button labeled "Show Main Form" and when I click it, it calls mainForm.BringToFront(). If there is some kind of error, then the main form will show a modal error MessageBox, which has the main form as its parent. When this happens, I am unable to click the button on the secondary form. In fact, I can't do anything with the secondary form (it's like it's completely disabled) unless I click Ok on the MessageBox, but to do that I need to first locate the main form, which is difficult because I have so many applications running. Can someone please help me, how can the secondary form still be running as usual when the error MessageBox is showing?
|
|
|
|
|
Not sure how to describe this or If I'm 100% correct here.
You seem to create the popup box in the same thread as your "main form" and "secondary form" are created in. Since you have specified the popup box's parent as your "main form" it's only expected that the popup box blocks everything for that thread. Therefore your "main form" and "secondary form" is blocked. You still need to look up the "main form", in your jungle of application, to gain access to your popup box.
Without viewing your code it's not that easy to suggest a fitting solution.
|
|
|
|
|
My code is very simple. The main form is created by the designer in the usual way:
public partial class Form1 : Form
Program.cs will create an instance of main form (or actually Form1):
Application.Run(new Form1());
Then I have a class called SecondaryForm, also created by the designer:
public partial class SecondaryForm: Form
In main form (or actually Form1), I create an instance of SecondaryForm:
SecondaryForm secondaryForm = new SecondaryForm();
secondaryForm.Visible = true;
When an error occurs, I show the MessageBox in main form (or actually Form1):
MessageBox.Show(this, "An error occurred!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
MessageBox is a Modal form - you know that because you called it that when you wrote the title.
And a modal form prevents anything else going on in the thread until the form has been dismissed, usually by pressing the OK or Cancel buttons.
Because Form1 and SecondaryForm are both running on the same thread (the UI thread, as they have to be) the use of a Modal form in either of them will automatically prevent the other from doing anything.
You can't "get round" that, you will have to write your own MessageBox form which is not modal, and display your messages in that.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
MessageBox is a modal dialog. This means that you cannot interact with the running application until you close it.
This space for rent
|
|
|
|
|
Hi,
As others have said, when a modal window is shown, a new message pump is launched and the previous one is temporarily disabled, so you can't interact with any other open window in your program for as long as the modal window is open.
However, you may drastically improve on the situation with a buried mainform by only using the MessageBox.Show() overloads that have an explicit owner as their first parameter (example[^]), where this would be the suggested value. Doing so the calling Form becomes the owner of the modal dialog (it isn't by default!) resulting in a more solidary behavior of caller and callee.
modified 16-Jan-19 9:47am.
|
|
|
|
|
Hi, Luc,
It's a great suggestion, however, I think the OP is already doing that:Quote: If there is some kind of error, then the main form will show a modal error MessageBox, which has the main form as its parent. Of course, there;s some critical information we don't have, like: where the error occurs.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Hi Bill,
I think you're right.
And anyways ownership doesn't really solve the problem when other applications add windows to the desktop...
|
|
|
|
|
imho, the main issue here is your overall strategy for error handling: in general, I think errors should be handled modally, stopping execution. imho, you should never "swallow" errors (handle errors without throwing) by just using a try/catch to "skip" over them.
However. for specific situations, like file and file-stream business, you may want to notify the user without stopping program execution, and not throw an error modally.
If I wanted to achieve what you describe, I would:
1. in the second form put a public Action method (delegate) that can be defined the main form:
using System;
using System.Windows.Forms;
namespace YourNameSpace
{
public partial class SecondaryForm : Form
{
public SecondaryForm()
{
InitializeComponent();
}
public Action<string, string, DateTime> SendErrorMessage;
private void button1_Click(object sender, EventArgs e)
{
try
{
throw new ArgumentException("some error");
}
catch (Exception ex)
{
SendErrorMessage?.Invoke(ex.Message, ex.Source, DateTime.Now);
}
}
}
} 2. in the MainForm:
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace YourNameSpace
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private SecondaryForm secondaryForm = new SecondaryForm();
private ErrorReportForm errForm = new ErrorReportForm();
private void Form1_Load(object sender, EventArgs e)
{
errForm.Owner = this;
secondaryForm.SendErrorMessage = SendErrorMessage;
errForm.Closing += errFormOnClosing;
}
private void button1_Click(object sender, EventArgs e)
{
secondaryForm?.Show();
}
private void SendErrorMessage(string err, string src, DateTime dtime)
{
this.BringToFront();
errForm.ShowErrForm(err, src, dtime);
}
private void errFormOnClosing(object sender, CancelEventArgs e)
{
secondaryForm.BringToFront();
}
}
} 3. something like this in an error report form with four textboxes:
using System;
using System.Windows.Forms;
namespace YourNameSpace
{
public partial class ErrorReportForm : Form
{
public ErrorReportForm()
{
InitializeComponent();
}
public void ShowErrForm(string err = "", string src = "", DateTime dt = default(DateTime))
{
tbxErr.Text = err;
tbxSrc.Text = src;
tbxDate.Text = dt.ToLongDateString();
tbxTime.Text = dt.ToLongTimeString();
this.Show();
}
}
} Of course, you want to consider what to do when/if the secondary form is closed.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
|
I have a large app that has been working for a while. I'm adding a new service class to it that is loaded as a MEF plugin. The service class loads some plugins that are NOT MEF plugins. I'm using relfection for those assemblies.
I'm getting this runtime exception on startup:
Cannot cast the underlying exported value of type
'Microsoft.Practices.Prism.MefExtensions.Regions.Behaviors.MefDelayedRegionCreationBehavior (ContractName="Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior")'
to type
'Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior'.
I can step through all of my code and everything runs, but after my class is contructed I get the error. If I comment out the part of my class that loads my assemblies, everything works fine. My assemblies don't error at all, and I can't see how externally loaded assemblies could cause some MEF problem.
I don't know MEF that well. I've Googled this a few different ways with no luck. Anyone know what this means?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I don't know a blessed thing about Prism, but it looks like the error that I get when trying to import an object that does not construct properly.
Are you trying to import a Prism region that might have a configuration issue, or might be influenced by an environmental factor?
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Hello,
Once I try to show up Access DB (.Accdb) in DataGridView, resolution of the form changes.
what is solution for this issue ? Thanks.
modified 13-Feb-19 21:02pm.
|
|
|
|