반응형
#region ImportDLL
[DllImport("Imm32.dll", SetLastError = true)]
public static extern IntPtr ImmGetContext(IntPtr hWnd);
[DllImport("imm32.dll")]
public static extern bool ImmGetConversionStatus(IntPtr himc, ref int lpdw, ref int lpdw2);
[DllImport("imm32.dll")]
public static extern bool ImmGetOpenStatus(IntPtr himc);
private Byte IME_CMODE_HANGEUL = 0x0001;
#endregion


  protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            //ime가 한글일경우 바로 editMode로 들어가도록 한다.  textbox입력 모드로 하기위해서
            int iMode = 0;
            int iSentence = 0;
            IntPtr HIme = ImmGetContext(this.dataGridViewUpload.Handle);
            bool bSuccess = ImmGetConversionStatus(HIme, ref iMode, ref iSentence);

            if (ImmGetOpenStatus(HIme))
            {

                if ((iMode & IME_CMODE_HANGEUL) > 0)
                {


                    if (!((keyData & Keys.Control) == Keys.Control))
                    {

                        switch (keyData)
                        {
                            case Keys.Up:
                            case Keys.Down:
                            case Keys.Left:
                            case Keys.Right:
                                break;
                            default:
                                dataGridViewUpload.BeginEdit(true);
                                break;
                        }

                    }
                }
            }

            if (keyData == Keys.Enter)
            {

                if (this.dataGridViewUpload.CurrentCell != null
                    && this.dataGridViewUpload.CurrentCell.IsInEditMode
                    && !(this.dataGridViewUpload.CurrentCell is DataGridViewCheckBoxCell))
                {
                    MoveNextCell();
                }
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
반응형
     
      using (Matrix matrix = new Matrix())
            {
  
                matrix .RotateAt(90f ,new PointF(원점)); 
               e.Graphics.MultiplyTransform(matrix );
               e.Graphics.DrawString("TestString", this.Font, Brushes.Black, 100, 100);
                matrix .Invert();
                e.Graphics.MultiplyTransform(matrix );

            }
반응형


1 mm =  2.83465 pt(point)

1 inch = 72 pt(point)

 

1 point = 1/72 inch

1 pixel = 1/96 inch (dpi 96)

 

Pixel 값 = (pointValue) * 96(dpi)/72

Point 값 = (pixelValue)*72/96(dpi)

 

 

반응형
const int MAX_PATH = 255;

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
    [MarshalAs(UnmanagedType.LPTStr)]
 string path,
    [MarshalAs(UnmanagedType.LPTStr)]
 StringBuilder shortPath,
    int shortPathLength
    );

private static string GetShortPath(string path)
{
    var shortPath = new StringBuilder(MAX_PATH);
    GetShortPathName(path, shortPath, MAX_PATH);
    return shortPath.ToString();
}

'Programing > C# ' 카테고리의 다른 글

Graphics Text Rotate 글자 회전  (0) 2013.12.18
point , inch, pixel ,mm 단위 관계  (0) 2013.12.11
Reflection 리플렉션 사용하기  (0) 2012.12.12
c# unicodeString to unicodevalue  (0) 2012.12.06
c# 코드 관리자 권한으로 실행  (0) 2012.11.06

+ Recent posts