|
What key actions do you want to intercept when a MessageBox is showing: only a few, perhaps like the Enter Key being pressed ... or, all key events ?
We need to know what you are doing now in code to get the Key up/down or press/release event. Show us the relevant code (but, not all your code !).
Is the Form in which you want to monitor keystrokes the Main Form of a WinForm Application ?
If you are using a MessageBox in WinForms, it is displayed modal, and it blocks the UI thread, so key events are not routed to the Form/Context that showed it.
It is not standard practice to allow key-entry in a MessageBox except for system-defined keys that have certain standard side-effects (like press 'Enter and you get the default MessageBoxButton 'clicked).
Depending on the information you provide, there may be several choices including using another Form, or a UserControl, shown modal, or more complex technique involving P/Invoke to WinAPI calls, or setting an Application Key Global Hook.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
modified 2-Nov-15 10:41am.
|
|
|
|
|
This is my code. what should i do if i want to make word in table center.
protected void ButtonCreatePDF_Click(object sender, EventArgs e)
{
var doc = new Document(PageSize.A4);
doc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
var output = new MemoryStream();
var writer = PdfWriter.GetInstance(doc, output);
doc.Open();
var titleFont = FontFactory.GetFont("Algerian", 35 );
var actionFont = FontFactory.GetFont("Comic Sans MS", 15);
var recipientFont = FontFactory.GetFont("Lucida Calligraphy", 25);
var reasonFont = FontFactory.GetFont("Comic Sans MS", 15);
var dateFont = FontFactory.GetFont("Lucida Calligraphy", 25);
var certDetailTable = new PdfPTable(1);
certDetailTable.HorizontalAlignment = Element.ALIGN_MIDDLE;
certDetailTable.SpacingAfter = 0;
certDetailTable.SpacingBefore = 0;
certDetailTable.DefaultCell.Border = 0;
certDetailTable.AddCell(new Phrase(TextBoxTITLE.Text, titleFont));
certDetailTable.AddCell(new Phrase(TextBoxACTION.Text, actionFont));
certDetailTable.AddCell(new Phrase(TextBoxRECIPIENT.Text, recipientFont));
certDetailTable.AddCell(new Phrase(TextBoxREASON.Text, reasonFont));
certDetailTable.AddCell(new Phrase(TextBoxDATE.Text, dateFont));
doc.Add(certDetailTable);
doc.Close();
Response.ContentType = "application/pdf";
Response.BinaryWrite(output.ToArray());
}
|
|
|
|
|
You need to create the Cell, set its horizontal alignment property to ALIGN_CENTER, then add the Cell; see: [^], [^].
There's a free book on ITextSharp available: [^].
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
CERTIFICATE OF ARCHIVEMENT
Presented To
Recipient Name
For Outstanding Archivement
Day/Month/Year
now, my pdf document contain all above word. the location of word is at left page. but i want to make those word located at the center of document.
|
|
|
|
|
Hi,
I want to download a csv file in a button click and send back to the control to another page. I have a page a.aspx where i need to download the csv. Once i download the csv the b.aspx should be loaded. i am getting an exception cannot redirect after http headers have been sent
My code is
ponse.ClearContent();
Response.ContentType = "application/text";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.Charset = "";
string sep = "";
for (int i = 0; i <= dtsorted.Columns.Count - 1; i++)
{
Response.Write(sep + dtsorted.Columns[i].ColumnName + ',');
}
Response.Write("\r\n");
for (int i = 0; i < dtsorted.Rows.Count; i++)
{
sep = "";
for (int j = 0; j <= dtsorted.Columns.Count - 1; j++)
{
Response.Write(sep + dtsorted.Rows[i].ItemArray[j].ToString() + ',');
}
Response.Write("\r\n");
}
Response.SuppressContent = true;
Response.Redirect("VerifyLPODetails.aspx", true);
if (!Response.IsRequestBeingRedirected)
{
Response.Redirect("VerifyLPODetails.aspx", true);
}
|
|
|
|
|
One request will generate one response. That response will either be a file, such as an HTML page or a CSV file, or a redirection to another page.
You can't return both a file and a redirection in the same response.
Add some javascript code to open a new window pointing to a handler which creates and returned the CSV file. After opening the window, the javascript code should then load the new page in the current window.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i will make a new software
but can i anyway make a code when i make in my speak a longer brake, he shot place a point, if i say make a new line the application schould write in a new line
|
|
|
|
|
Sure you can, but I think, for your initial prototype, you should consider trying to use specific commands, rather than looking for pauses of greater than a certain length to trigger an action. I'd choose some special word to serve as a "trigger:" to indicate that the word that follows the trigger is parsed as a "command."
For example: trigger : "Parse"
Parse return // append period followed by cr/lf pair
Parse newline // append cr/lf pair
Start by getting oriented about the speech-recognition library Microsoft provides: [^].
The good news for you is that CodeProject has many excellent articles that will help you get started with your application: [^].
And, don't forget to read the tutorials by Microsoft on speech-recognition.
Once you have your project in progress, as you have specific problems, or questions, do come back here (or use the QA forum) to post your questions including selected pieces of your code directly related to the issue/problem.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
I suggest you to read about "Project Oxford" from Microsoft. It exposes web API for speech recognition and supports NLU
|
|
|
|
|
How do you be gritty in c # webbrowser to support Windows Media Player
|
|
|
|
|
Eh? What do you mean by gritty? I'm sorry but your question makes no sense in this form.
|
|
|
|
|
First, is this WinForms, WPF, ASP.NET ?
"True Grits" starts when you put your fingers on the computer keyboard and search CodeProject, the web, and StackOverFlow.
First, you must deal with the question of whether grits can be found and used in the way you describe. You might run into a problem like the one described here: [^], where the versions of Windows and/or WMP are incompatible.
Once you know that grits is available, you harvest the raw grits by reading the relevant links in your search results, and/or studying relevant code you discover in the links.
For the raw grits to be useful, it needs to get ripe. So you create a WinForms or WPF project, you put a web-browser control on it, you do what it takes to get the Windows Media Player object loaded (an HTML file opened) in that WebBrowser control, and the right connections made to a valid media source, and the play command issues.
... and you ask specific question here describing any problem(s) you are having, showing the relevant code in your project as necessary.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
modified 1-Nov-15 4:06am.
|
|
|
|
|
BillWoodruff wrote: For the raw grit to be useful, it needs to get ripe.
Unfortunately, raw grit is like supermarket fruit: you can wait forever for it to ripen to luscious edibility only to find that 30 seconds later it has gone off and is inedible...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Well, OG, down in the American south where I came from, grit, as in grits, is an all-white meal/flour made from maize (boiled corn) that has about zero nutritional value, and is pretty much tasteless, which is why it's probably so popular as part of breakfast. Almost all American grits nowadays is made from alkali treated corn (i.e., technically it's a form of hominy).
Grits is the official prepared food of the state of Georgia in the U.S.
Typically served with loads of butter, salt, pepper, increasing its value in promoting heart-attack, stroke, obesity, arterial congestion, etc. It is often deep-fried into patties in oil (preferably slightly rancid left-over bacon-grease) to round out its toxicity with some saturated-fats.
I suspect you English boys think of grit in terms of nail-files, sand-paper, or macadam, or some other esoteric use.
It is true, for American grits, that if they are not in a tightly sealed container they will get infested with something insectoid pronto.
cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
BillWoodruff wrote: I suspect you English boys think of grit in terms of nail-files, sand-paper, or macadam, or some other esoteric use.
Personally, I think of grit as lightly grated John Wayne...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
helo friends any one who have knowledge about ocr . i want to ask what is the latest ocr library ... or api or sdk.. m some confused. and wanna make latest ocr based software in c#
|
|
|
|
|
Please don't post the same thing repeatedly: I deleted the "spare" in this forum, but you also have a copy in QA. All you will do is duplicate work and annoy people. Pick either the C# forum or QA and stick with it.
Annoyed people are less likely to be helpful than happy ones...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
hi,
i have this code for reading xml file into my list.
var zfullname, zphone_M, zphone_F, zMail, zFname,zLname;
var ALL;
var Fname, Lname, Phone_M, Phone_F, Mail;
function XX() {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "Phone.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
$("#ZIZI").empty();
var x = xmlDoc.getElementsByTagName("MEN");
for (i = 0; i < x.length; i++) {
try { Fname = x[i].getElementsByTagName("Fname")[0].childNodes[0].nodeValue; }
catch (err) { Fname = "0"; }
try { Lname = x[i].getElementsByTagName("Lname")[0].childNodes[0].nodeValue; }
catch (err) { Lname = "0"; }
try { Phone_M = x[i].getElementsByTagName("Phone_M")[0].childNodes[0].nodeValue; }
catch (err) { Phone_M = "0"; }
try { Phone_F = x[i].getElementsByTagName("Phone_F")[0].childNodes[0].nodeValue; }
catch (err) { Phone_F = "0"; }
try { Mail = x[i].getElementsByTagName("Mail")[0].childNodes[0].nodeValue; }
catch (err) { Mail = "0"; }
if (Mail == "0") Mail = " ";
if (Phone_M == "0") Phone_M = " ";
if (Phone_F == "0") Phone_F = " ";
ALL =
'<li >' +
'<a href="men.html" data-transition="flip">' +
'<div class="ui-grid-a" id="restau_infos"> ' +
'<p style="font-size:22px; margin:0px;padding:0px;" class="nam"><b>' + Fname + " " + Lname + '</b></p>' +
'<p style="font-size:16px; margin:0px;padding:0px;" class="phn">' + Phone_M + '</p>' +
'<p style="font-size:16px; margin:0px;padding:0px;" class="phn2">' + Phone_F + '</p>' +
'<p style="font-size:14px; margin:1px;padding:1px;" class="crr">' + Mail + '</p>' +
' </div>' +
'</a>' +
'<a href="tel:' + Phone_M + ' data-icon="location" ></a>' +
'</li>'
$("#ZIZI").append(ALL);
$("#ZIZI").listview("refresh");
}
}
this work excellent.
i have WebService that return DataSet.
string SQL;
DataSet dsView;
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public DataSet GetData( string sel)
{
dsView = new DataSet();
MyParam.OpenConnection();
SQL = "select Fname,Lname,S_phone from MEN where sel = '" + sel + "'";
dsView = new DataSet();
MyParam.adp = new SqlDataAdapter(SQL, MyParam.Conn);
MyParam.adp.Fill(dsView, "MEN");
MyParam.adp.Dispose();
if (dsView.Tables["MEN"].Rows.Count >= 1)
{
return dsView;
}
else
{
return null;
}
}
How to combine both that i can read from the WebService ?
(the WebService in 127.0.0.1/WS_TEST/Service1.asmx for example)
thanks
|
|
|
|
|
|
|
Why would this question be c# related?
|
|
|
|
|
You'll probably need a newer version of the Management Studio. Download one of the recent Express editions for free.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am somewhat beginning with threads, and I am wondering if following class is thread safe? Or in which cases it is thread safe? The idea is users should be able to initialize this class once, second time initialization should not work if deinitialization was not called. But getting the properties should give correct results... and here I am having hard time to determine in which case those properties will get correct results, and if init and deinit methods are thread safe, as well as isInited method. Help appreciated. I tried make it immutable also.
static class Parameters
{
private static int x1;
private static int x2;
private static bool isInit;
private static readonly object Locker = new object();
public static bool isInited()
{
lock(Locker)
{
return isInit;
}
}
public static int X1()
{
if(!isInited()) throw new Exception("init first");
return x1;
}
public static int X2()
{
lock(Locker)
{
if(!isInited()) throw new Exception("init first");
return x2;
}
}
public static void init(int x, int y)
{
lock(Locker)
{
if(isInit) return;
isInit = true;
x1 = x;
x2 = y;
}
}
public static void Deinit()
{
lock(Locker)
{
if(!isInit) return;
isInit = false;
x1 = 0;
x2 = 0;
}
}
}
Or the client - user of this class has to take additional means to ensure this class is used in thread safe manner? Feedback appreciated
modified 30-Oct-15 16:23pm.
|
|
|
|
|
I believe what you are after is the Singleton design-pattern.
In addition to several articles on the Singleton design-pattern you can find here on CodeProject, there is a very useful analysis of different approaches by Jon Skeet (the C# uber-guru) here: [^] that covers issues of locking (thread safety), lazy initializtion, etc.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|