|
You will need to override ProcessCmdKey method to catch the arrow key press.
|
|
|
|
|
Hi d@nish,
Can you please give me a simple explain on it, where should i put the override code, and should i add the virtual method on it(for override)?
thanks in advance
cocoonwls
|
|
|
|
|
You just need to override the method in your class. This VB.Net[^] code should get you going with it.
|
|
|
|
|
Thanks i got it!
|
|
|
|
|
you must derive a new class that is based on the class of the control that you want, and you override the ProcessCmdKey().
Syntax:
C#:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
}
Full source code..C# Arrow Key Press
Vayne
|
|
|
|
|
I've got the following code that attaches a thumbnail image coming from an ImageList to a PictureBox. However, it is causing my application to not close once the code block gets executed. I suspect this has got to do with the resource(the photo file) not being released properly, I may be wrong though. Any experts advice would be greatly appreciated. All the best!
<br />
Image.GetThumbnailImageAbort myCallback =<br />
new Image.GetThumbnailImageAbort(ThumbnailCallback);<br />
Image myThumbnail = this.imageList1.Images[0].GetThumbnailImage(this.pictureBox1.Size.Width-5, this.pictureBox1.Size.Height-5, myCallback, IntPtr.Zero);<br />
<br />
this.pictureBox1.Image = myThumbnail;<br />
this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
----------------------------------------------------------
"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep" - my daily unix command list
|
|
|
|
|
The code works fine for me.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
Image myThumbnail = this.imageList1.Images[0].GetThumbnailImage(this.pictureBox1.Size.Width - 5, this.pictureBox1.Size.Height - 5, myCallback, IntPtr.Zero);
this.pictureBox1.Image = myThumbnail;
this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
private bool ThumbnailCallback()
{
return true;
}
}
And the app exits fine.
Failure to exit is usually caused by a thread not terminating correctly. Does your abort callback get triggered? Does it correctly return?
You don't need to release the Image. This is handled by the Imagelist for you provided that you have added your image list via the designer or correctly disposed of it manually, either way though, this wouldn't prevent your app from closing.
After you have closed your app, and it's stuck without terminating, try hitting the pause button and looking at the call stack to see where it is stuck.
Simon
|
|
|
|
|
hello all,
i am new in window apllication c#. when i load rtf file in richtextbox control with every new paragraph with and <\p>.
i have done this..but can't remove whitespace.
he show with blankspace <\p>.
like..there is five paragraph in file.
aaaaaaaaaaaaaaaaaaaaaaaaaa<\p>
<\p>
<\p>
aaaaaaaaaaaaaaaaaaaaaaaaaa<\p>
aaaaaaaaaaaaaaaaaaaaaaaaaa<\p>
here, i want to remove two blanckspaces..
|
|
|
|
|
what is <\p> ?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
|
how To Add Product key Setup please help me
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
We cant help if we dont know your specific problem.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I want to modify this RegisterHotKey func to allow me to set it using HashKey instead of a shortcut key but I'm not exactly sure how to do this.
this is the code for registering the hotkey in the object
protected bool RegisterHotkey(Shortcut key)
{
int mod=0;
Keys k2=Keys.None;
if (((int)key & (int)Keys.Alt)==(int)Keys.Alt) {mod+=(int)Win32.Modifiers.MOD_ALT;k2=Keys.Alt;}
if (((int)key & (int)Keys.Shift)==(int)Keys.Shift) {mod+=(int)Win32.Modifiers.MOD_SHIFT;k2=Keys.Shift;}
if (((int)key & (int)Keys.Control)==(int)Keys.Control) {mod+=(int)Win32.Modifiers.MOD_CONTROL;k2=Keys.Control;}
System.Diagnostics.Debug.Write(mod.ToString()+" ");
System.Diagnostics.Debug.WriteLine((((int)key)-((int)k2)).ToString());
return Win32.User32.RegisterHotKey(m_Window.Handle, this.GetType().GetHashCode(), (int)mod, ((int)key) - ((int)k2));
}
|
|
|
|
|
Hi guys,
I have created a windows based project for my client and it works fine for him. He is my client and want to sell this product to further clients, so for this he wants that in deployment of the project a screen should appear that shows about to insert a license key and it must match with a license which is stored in an online database.
Creation of database and checking of license key is I think is not typical, but the typical act is how to create a screen which appears in the deployment of that project and appears at the time of installation.
If any one help me then I will be highly thankful to that person.
Thanks in Advance
|
|
|
|
|
What you are after, sounds like a Splash Screen:
www.codeproject.com/KB/cs/prettygoodsplashscreen.aspx[^]
You can add additional arguments in the code, which check to see if the project is registered or not, and if it is already registered, to not even display the Splash Screen, and just head to the main screen.
|
|
|
|
|
Hi,
I want to display the messages from Queue in consoleapplication.I am able to read the queues.But while displaying, if i had 6 messages in queue and in that i am able to display only 3.Please help me out in solving this.
My code is as follows:
string QueueName = ".\\Private$\\TestQ";
MessageQueue.EnableConnectionCache = false;
//// open the selected message queue
this.messageQueue = new MessageQueue(QueueName, QueueAccessMode.Receive);
while (true)
{
System.Messaging.Message message = new System.Messaging.Message();
MessageQueueTransaction msgTx = new MessageQueueTransaction();
MessageDetails messageDetails = null;
try
{
msgTx.Begin();
message.Formatter = new BinaryMessageFormatter();
message = messageQueue.Receive(new TimeSpan(0, 0, 0, 10), msgTx);
if (message.Body != null)
{
messageDetails = (MessageDetails)message.Body;
Console.WriteLine(messageDetails.ApplicationName + "\t" + messageDetails.ThreadName + "\t" + messageDetails.Status + "\t" + messageDetails.TimeStamp);
}
msgTx.Commit();
messageQueue.BeginReceive();
}
Thanks in Advance
|
|
|
|
|
is messageQueue subscribed to receive the callback from the BeginReceive() call? if not that'll probably discard every other message in the queue.
|
|
|
|
|
I've tried to capture the desktop with the cursor image using different codes and none manages to draw the IBeam cursor. If I use the Cursor.Current, I always get the waitcursor; using API, I get the correct cursor. Is there a workaround?
|
|
|
|
|
Nothing, guys? From what I've seen during my google searches, this is a common problem so I think there must be a workaround. I know that Ibeam is a xor cursor, but I don't know how to get the xor mask using CursorInfo.
|
|
|
|
|
when should we use Convert.ToDouble and Double.Parse
Thanks
|
|
|
|
|
Convert.ToDouble[^] allows you to convert other types to a Double.
Double.Parse[^] parses a string and attempts to convert it to a Double (although normally Double.TryParse[^] would be better).
Learn how to use MSDN and Google - the links I've given were first in the lists on Google!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
|
Why did you feel the need to post this question in no less than 7 different forum?? It's no longer likely your ever going to get an answer to this question seeing as you saw fit to do what everyone hates -> SPAM this site with your question. Pick a single forum most appropriate for your subject, like General Discussions in your case, and post your question ONCE!
|
|
|
|
|
...
Blog link to be reinstated at a later date.
|
|
|
|
|
I have some code that we use to parse the contents of a folder and perform actions based on file dates. We would now like to do the same over our internal network to a location such as http://server.company.com:8080/files. Unfortunately, the DirectoryInfo method does not support this type of path. Is there a similar method that can be used for this type of path?
|
|
|
|