예제 #1
0
        public static void AssertWin32(bool expression, string message)
        {
#if DEBUG
            if (!expression)
            {
                Debug.Fail(message + "\r\nError: " + DbgUtil.GetLastErrorStr());
            }
#endif
        }
예제 #2
0
        [Conditional("DEBUG")] // This code will be compiled into the assembly anyways, it is up to the compiler to ignore the call.
        private static void AssertWin32Impl(bool expression, string format, object[] args)
        {
#if DEBUG
            if (!expression)
            {
                string message = string.Format(CultureInfo.CurrentCulture, format, args);
                Debug.Fail(message + "\r\nError: " + DbgUtil.GetLastErrorStr());
            }
#endif
        }
예제 #3
0
        protected override void CreateBrush()
        {
            IntPtr nativeHandle = SafeNativeMethods.CreateSolidBrush(ColorTranslator.ToWin32(Color));

            if (nativeHandle == IntPtr.Zero) // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated.
            {
                Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr());
            }

            NativeHandle = nativeHandle;  // sets the handle value in the base class.
        }
예제 #4
0
        protected override void CreateBrush()
        {
            IntPtr nativeHandle = Gdi32.CreateSolidBrush(ColorTranslator.ToWin32(Color));

            // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated.
            if (nativeHandle == IntPtr.Zero)
            {
                Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr());
            }

            HBrush = nativeHandle;
        }