PDA

View Full Version : کاراکترهای خاص



code_project
سه شنبه 08 دی 1388, 17:20 عصر
سلام دوستان گرامی
میخواستم بدونم چطوری برای کاربری که با برنامه ام کار میکنه این امکان را فراهم کنم که بتونه کاراکترهای خاص نظیر حروف یونانی را توی تکست باکس تایپ کنه. ممنون میشم راهنماییم کنین...

AliRezaPro
سه شنبه 08 دی 1388, 20:09 عصر
خوب هنگام وارد کردن کاراکنر چک کن که چه کاراکتری رو داره وارد میکنه و اگر اون کاراکتر مورد نظر شما نبود هندل رو از اون شئ بگیر

code_project
چهارشنبه 09 دی 1388, 06:49 صبح
بازم سلام...
من میخوام با زدن یه دکمه که کنار تکست باکسم گذاشتم یه کیبورد مجازی با کاراکترهای خاص برای کاربر باز بشه و کاربر با موس روی کاراکتر کلیک کنه تا در تکست باکس درج بشه
بازم ممنون میشم اگه...

FastCode
چهارشنبه 09 دی 1388, 09:47 صبح
using System.Runtime.InteropServices;
...

public class MyClass {


private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOZORDER = 0x0004;
private const uint SWP_NOREDRAW = 0x0008;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_FRAMECHANGED = 0x0020;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_HIDEWINDOW = 0x0080;
private const uint SWP_NOCOPYBITS = 0x0100;
private const uint SWP_NOOWNERZORDER = 0x0200;
private const uint SWP_NOSENDCHANGING = 0x0400;

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X,
int Y, int cx, int cy, uint uFlags);

[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);

......

private void showKeypad()
{

process = new Process();

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = "c:\\winnt\\system32\\osk.exe";
process.StartInfo.Arguments = "";
process.StartInfo.WorkingDirectory = "c:\\";
process.Start(); // Start Onscreen Keyboard
process.WaitForInputIdle();

SetWindowPos( process.MainWindowHandle,
this.Handle, // Parent Window
this.Left, // Keypad Position X
this.Top+20, // Keypad Position Y
panelButtons.Width, // Keypad Width
panelButtons.Height, // Keypad Height
SWP_SHOWWINDOW | SWP_NOZORDER); // Show Window and Place on Top

SetForegroundWindow(process.MainWindowHandle);
}
}