Ejemplo n.º 1
0
 private void Initialize2()
 {
     this.format = new StringFormat();
     this.gr     = this.CreateGraphicsBuf();
     //this.gr=this.CreateGraphics();
     this.caret = mwg.Windows.Caret.CreateNew(this);
     this.sd    = new mwg.Drawing.StringDrawer(this);
     this.ime   = new IME(this);
     //
     // caret
     //
     //this.caret.Size=new Size(1,10);
     //
     // sd
     //
     this.sd.LetterSpacing     = 0;
     this.sd.Font              = new System.Drawing.Font("MS ゴシック", 9);
     this.sd.Rectangle         = new Rectangle(10, 10, 200, 200);
     this.sd.Return            = true;
     this.sd.Position          = new PointF(10, 10);
     this.sd.PositionChanged  += new mwg.Drawing.StringDrawer.PositionEvent(sd_PositionChanged);
     this.sd.FontChanged      += new mwg.Drawing.StringDrawer.FontEventHandler(sd_FontChanged);
     this.sd.DirectionChanged += new mwg.Drawing.StringDrawer.FontEventHandler(sd_DirectionChanged);
     //this.sd.Vertical=true;
     //this.sd.RTL=true;
     //
     // ime
     //
     this.ime.Char             += new mwg.Windows.IME.CompositionEventHandler(this.ime_Char);
     this.ime.StartComposition += new EventHandler(this.ime_StartComposition);
 }
Ejemplo n.º 2
0
        protected void OnConversionStatusEvent(string eventName)
        {
            ConversionStatusEH cseh = this._events[eventName] as IME.ConversionStatusEH;

            if (cseh != null)
            {
                IME.CMODE cmode = (IME.CMODE) 0;
                IME.SMODE smode = (IME.SMODE) 0;
                IME.ImmGetConversionStatus(this.hIMC, cmode, smode);
                cseh(this, new ConversionStatusEA(cmode, smode));
            }
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     if (!this.available)
     {
         return;
     }
     this.ctrl.WindowProc -= new mwg.Windows.ControlA.WndProcEvent(ctrl_WindowProc);
     this.available        = false;
     this.hImc             = System.IntPtr.Zero;
     this.hWnd             = System.IntPtr.Zero;
     IME.ImmReleaseContext(this.hWnd, this.hImc);
 }
Ejemplo n.º 4
0
        //***********************************************************
        //		<method> GetCandidateList
        //-----------------------------------------------------------
        private IME.CandidateList GetCandidateList()
        {
            int dwSize = IME.ImmGetCandidateList(this.hIMC, 0, (byte[])null, 0);

            if (dwSize == 0)
            {
                return(new CandidateList());
            }
            byte[] lpcdl = new byte[dwSize];
            IME.ImmGetCandidateList(this.hIMC, 0, lpcdl, dwSize);
            IME.CandidateList r = new CandidateList(lpcdl);
            return(r);
        }
Ejemplo n.º 5
0
        /*private System.Text.Encoding IMEEncoding(string imeDesc){
         *      switch(imeDesc){
         *              case "微??音?入法 3.0":
         *                      return System.Text.Encoding.GetEncoding("gb2312");
         *              case "ATOK16":
         *              default:
         *                      return System.Text.Encoding.GetEncoding("shift-jis");
         *      }
         *      if(imeDesc.GetHashCode)
         * }//*/

#if debug
        private byte[] GetDescriptionB()
        {
            System.IntPtr hKL = this.hKL;
            int           l   = IME.ImmGetDescriptionB(hKL, null, 0);

            byte[] buf = new byte[l];
            IME.ImmGetDescriptionB(hKL, buf, (uint)l);
            while (buf[l - 1] == 0)
            {
                l--;
            }
            if (buf.Length == l)
            {
                return(buf);
            }
            byte[] buf2 = new byte[l];
            System.Array.Copy(buf, buf2, l);
            return(buf2);
        }
Ejemplo n.º 6
0
 //***********************************************************
 //			インスタンスの作成
 //-----------------------------------------------------------
 public IME(mwg.Windows.ControlA ctrl)
 {
     this.ctrl = ctrl;
     this.hWnd = ctrl.Handle;
     this.hImc = IME.ImmGetContext(hWnd);
     if (this.hImc == System.IntPtr.Zero)
     {
         //throw new System.Exception("mwg.WIndows.IME:インスタンス初期化に失敗しました");
         this.available = false;
         return;
     }
     this.position               = new System.Drawing.Point(0, 0);
     this.available              = true;
     this.cmpForm                = new COMPOSITIONFORM();
     this.cmpForm.dwStyle        = CFS.POINT;
     this.cmpForm.ptCurrentPos.X = 0;
     this.cmpForm.ptCurrentPos.Y = 0;
     ctrl.WindowProc            += new mwg.Windows.ControlA.WndProcEvent(ctrl_WindowProc);
 }
Ejemplo n.º 7
0
        //***********************************************************
        //		編集文字列
        //-----------------------------------------------------------
        #region Composition
        //***********************************************************
        //		<method> GetCompositionString
        //-----------------------------------------------------------
        /// <summary>
        /// IME の文字列を取得します。(Shift_JIS 文字の読み取りしかできません)
        /// </summary>
        /// <param name="dwIndex">どの文字列を取得するかを mwg.Windows.IME+GCS で指定します。</param>
        /// <returns>指定の文字列を返します</returns>
        public string GetCompositionString(IME.GCS dwIndex)
        {
            string str = "";

            try{
                System.IntPtr hImc0 = this.hIMC;
                int           len   = IME.ImmGetCompositionStringB(hImc0, (uint)dwIndex, null, 0);
                byte[]        lpBuf = new byte[len + 1];
                IME.ImmGetCompositionStringB(hImc0, (uint)dwIndex, lpBuf, (uint)len + 1);
                // Default: shift-jis: 中国語読み取り不能
                // Unicode: gb2312: もっと不可能
                str = System.Text.Encoding.Default.GetString(lpBuf, 0, len);
                //何故かごみが入るので除去
                if (str.Length == 2 && (int)str.ToCharArray(1, 1)[0] == 0xf8f3)
                {
                    str = str.Substring(0, 1);
                }
            }catch (System.Exception e) { throw e; }
            return(str);
        }
Ejemplo n.º 8
0
 public void Notify(IME.NI action, int index, int val)
 {
     IME.ImmNotifyIME(this.hImc, action, index, val);
 }