Beispiel #1
0
        public static void ReleaseDCChecked(HWND hWnd, HDC hDC)
        {
            int res = ReleaseDC(hWnd, hDC);

            if (res != 1)
            {
                throw new InvalidOperationException($"{nameof(ReleaseDC)} failed. Window handle: 0x{hWnd.ToString("X16")}. HDC: 0x{hDC.ToString("X16")}.");
            }
        }
Beispiel #2
0
        public static Func <string, DictBase> Ctor(Type type)
        {
            StrTypeCache[type.GetDevelopName()] = type;
            //获得动态生成的类型
            Type result = DictBuilder.InitType(type, Core.Model.FindTreeType.Fuzzy);
            //加入缓存
            string script = $"return new {result.GetDevelopName()}();";

            _str_cache[type.GetDevelopName()] = script;
            _type_cache[type] = script;


            //生成脚本
            //生成脚本
            HDC <Type, string, DictBase> handler = default;

            if (_hdc.BuilderInfo != null)
            {
                handler = _hdc | _str_cache;
            }
            else
            {
                handler = (_hdc | _str_cache | HashDictOperator.CreateFromString | HashDictBuilder.Ctor) % CallerManagement.GetTypeFunc;
            }
            return(NDelegate.UseDomain(type.GetDomain()).UnsafeFunc <string, DictBase>(handler.ToString(), _type_cache.Keys.ToArray(), "NCallerDynamic", "NCaller.Builder"));
        }
Beispiel #3
0
        public static HDC CreateCompatibleDCChecked(HDC hdc)
        {
            HDC newHdc = CreateCompatibleDC(hdc);

            if (newHdc == IntPtr.Zero)
            {
                throw new InvalidOperationException($"{nameof(CreateCompatibleDC)} failed. Original device context: 0x{hdc.ToString("X16")}.");
            }

            return(newHdc);
        }