• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MARGINS类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MARGINS的典型用法代码示例。如果您正苦于以下问题:C# MARGINS类的具体用法?C# MARGINS怎么用?C# MARGINS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MARGINS类属于命名空间,在下文中一共展示了MARGINS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DwmExtendFrameIntoClientArea

 public static void DwmExtendFrameIntoClientArea(Control c, MARGINS marg)
 {
     if (DwmIsCompositionEnabled())
     {
         DwmExtendFrameIntoClientArea(c.Handle, ref marg);
     }
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:7,代码来源:DWMAPI.cs


示例2: ExtendGlassFrame

        /// <summary>
        /// Extends the Aero Glass area on a given window.
        /// </summary>
        /// <param name="window">The window to extend glass onto.</param>
        /// <param name="margin">The distances from the border to extend the glass by.</param>
        /// <returns>True if glass was extended successfully, otherwise false.</returns>
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            bool result = false;
            try {
                if (DwmIsCompositionEnabled()) {

                    IntPtr hwnd = new WindowInteropHelper(window).Handle;
                    if (hwnd == IntPtr.Zero)
                        throw new InvalidOperationException("The Window must be shown before extending glass.");

                    // Set the background to transparent from both the WPF and Win32 perspectives
                    window.Background = Brushes.Transparent;
                    HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

                    MARGINS margins = new MARGINS(margin);
                    DwmExtendFrameIntoClientArea(hwnd, ref margins);
                    result = true;
                }
            } catch { }
            return result;
        }
开发者ID:PaulStovell,项目名称:trial-balance,代码行数:31,代码来源:GlassHelper.cs


示例3: ConvertMp3_Load

        private void ConvertMp3_Load(object sender, EventArgs e)
        {
            MARGINS margins = new MARGINS();
            margins.cxLeftWidth = 0;
            margins.cxRightWidth = 0;
            margins.cyTopHeight = 45;
            margins.cyBottomHeight = 0;

            IntPtr hWnd = this.Handle;
            int result = DwmExtendFrameIntoClientArea(hWnd, ref margins);

            Process bacon = new Process();
            ProcessStartInfo p = new ProcessStartInfo();
            string sArgs = String.Format(" -i {0} {1}", SourcePath, TargetPath);
            p.FileName = Directory.GetCurrentDirectory()[email protected]"\ffmpeg.exe";
            p.CreateNoWindow = true;
            p.RedirectStandardOutput = true;
            p.UseShellExecute = false;

            bacon.Exited += new EventHandler(myProcess_Exited);

            p.Arguments = sArgs;
            bacon.StartInfo = p;
            bacon.Start();
            bacon.WaitForExit();
            bacon.StandardOutput.ReadToEnd();
            if (FileToDelte != null)
            {
                try { File.Delete(FileToDelte); }
                catch { }
            }
            this.Close();
        }
开发者ID:xarinatan,项目名称:o3o,代码行数:33,代码来源:ConvertMp3.cs


示例4: OpenAreo

 private void OpenAreo()
 {
     en = 0;
     MARGINS mg = new MARGINS(); //定义透明扩展区域的大小,这里全部-1,即全部透明
     mg.m_Buttom = -1;
     mg.m_Left = -1;
     mg.m_Right = -1;
     mg.m_Top = -1;
     //判断是否Vista及以上的系统
     if (System.Environment.OSVersion.Version.Major >= 6)
     {
         DwmIsCompositionEnabled(ref en);    //检测Aero是否为打开
         if (en > 0)
         {
             DwmExtendFrameIntoClientArea(this.Handle, ref mg);   //透明
         }
         else
         {
             MessageBox.Show("Desktop Composition is Disabled!");  //未开启透明桌面
         }
     }
     else
     {
         MessageBox.Show("Please run this at least on Windows Vista.");  //至少在vista运行
     }
     this.Paint += new PaintEventHandler(Form1_Paint);
 }
开发者ID:XHerbert,项目名称:XSmartNote,代码行数:27,代码来源:FormMaster.cs


示例5: ExtendGlassFrame

        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            // Get the Operating System From Environment Class
            OperatingSystem os = Environment.OSVersion;

            // Get the version information
            Version vs = os.Version;

            if (vs.Major < 6)
                return false;

            if (!DwmIsCompositionEnabled())
                return false;

            IntPtr hwnd = new WindowInteropHelper(window).Handle;
            if (hwnd == IntPtr.Zero)
                throw new InvalidOperationException("Glass cannot be extended before the window is shown.");

            // Set the background to transparent from both the WPF and Win32 perspectives
            window.Background = Brushes.Transparent;
            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

            MARGINS margins = new MARGINS(margin);
            DwmExtendFrameIntoClientArea(hwnd, ref margins);

            return true;
        }
开发者ID:brschwalm,项目名称:Vienna,代码行数:27,代码来源:GlassHelper.cs


示例6: ApplyGlass

 public static void ApplyGlass(Form form)
 {
     MARGINS m = new MARGINS(-1, -1, -1, -1);
     //MARGINS m = new MARGINS(1, 1, 1, 1);
     form.Paint += new PaintEventHandler(form_Paint);
     DwmExtendFrameIntoClientArea(form.Handle, m);
 }
开发者ID:WisdomWolf,项目名称:thumbpreview,代码行数:7,代码来源:DWM.cs


示例7: Form1_Load

 private void Form1_Load(object sender, EventArgs e)
 {
     this.BackColor = Color.Black;
     MARGINS m=new MARGINS();
     m.cxLeftWidth = 20;
     m.cxRightWidth = 20;
     m.cyBottomHeight = 20;
     m.cyTopHeight = 20;
     DwmExtendFrameIntoClientArea(this.Handle,m);
 }
开发者ID:Wagnerp,项目名称:mvt-aero-glass-windows-form,代码行数:10,代码来源:Form1.cs


示例8: ShowShadowUnderWindow

        public static void ShowShadowUnderWindow(IntPtr intPtr)
        {
            MARGINS marInset = new MARGINS();
              marInset.m_bottomHeight = -1;
              marInset.m_leftWidth = -1;
              marInset.m_rightWidth = -1;
              marInset.m_topHeight = -1;

              DwmExtendFrameIntoClientArea(intPtr, ref marInset);
        }
开发者ID:thirkcircus,项目名称:ServiceBusMQManager,代码行数:10,代码来源:Native.cs


示例9: WndStart

    void WndStart()
    {
        var margins = new MARGINS() { cxLeftWidth = -1 };
        var hwnd = FindWindow(null, "CooldogAssistant");

        SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);

        DwmExtendFrameIntoClientArea(hwnd, ref margins);

		SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 512, 512, SWP_NOMOVE);
    }
开发者ID:renaudbedard,项目名称:cooldog-assistant,代码行数:11,代码来源:TransparentWindow.cs


示例10: AeroEffect

 public static void AeroEffect(Form f1)
 {
     MARGINS m = new MARGINS()
     {
         left = -1
     };
     DwmExtendFrameIntoClientArea(f1.Handle, ref m);
     Color aeroColor = Color.FromArgb(155, 155, 155);
     f1.TransparencyKey = aeroColor;
     f1.BackColor = aeroColor;
 }
开发者ID:KeithLee208,项目名称:ISoft_Source,代码行数:11,代码来源:AeroForm.cs


示例11: ExtendFrameIntoClientArea

 /// <summary>
 /// Extends the window frame into the client area.
 /// </summary>
 /// <param name="hWnd">The handle to the window in which the frame will be extended into the client area.</param>
 /// <param name="left">The left margin.</param>
 /// <param name="top">The top margin.</param>
 /// <param name="right">The right margin.</param>
 /// <param name="bottom">The bottom margin.</param>
 /// <returns></returns>
 public static bool ExtendFrameIntoClientArea(IntPtr hWnd, int left, int top, int right, int bottom)
 {
     if (IsPlatformSupported)
     {
         MARGINS m = new MARGINS();
         m.cxLeftWidth = left;
         m.cyTopHeight = top;
         m.cxRightWidth = right;
         m.cyBottomHeight = bottom;
         return NativeMethods.DwmExtendFrameIntoClientArea(hWnd, ref m).Succeeded;
     }
     return false;
 }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:22,代码来源:Dwmapi.cs


示例12: Form1_Load

        /// <summary>
        /// Define some element properties and init Aero Glass if using Vista or newer
        /// </summary>

        private void Form1_Load(object sender, EventArgs e)
        {
            box_output.ScrollBars = RichTextBoxScrollBars.None;
            box_output.Font = new Font("Consolas", 8);
            box_output.BackColor = Color.White;

            if (Environment.OSVersion.Version.Major >= 6)
            {
                this.BackColor = Color.DarkMagenta; this.TransparencyKey = Color.DarkMagenta;
                MARGINS marg = new MARGINS() { Left = -1, Right = -1, Top = -1, Bottom = -1 };
                DwmExtendFrameIntoClientArea(this.Handle, ref marg);
            }
        }
开发者ID:corwinbass,项目名称:Minecraft-Console-Client,代码行数:17,代码来源:Form1.cs


示例13: GlassifyHwnd

 public static bool GlassifyHwnd(IntPtr ptr)
 {
     if (Environment.OSVersion.Version.Major >= 6 && DwmIsCompositionEnabled())
     {
         MARGINS margins = new MARGINS();
         margins.Left = -1;
         margins.Right = -1;
         margins.Top = -1;
         margins.Bottom = -1;
         return !DwmExtendFrameIntoClientArea(ptr, ref margins);
     }
     return false;
 }
开发者ID:byteit101,项目名称:ZomB-Dashboard-System,代码行数:13,代码来源:AeroGlass.cs


示例14: Start

 void Start()
 {
    // #if !UNITY_EDITOR
     var margins = new MARGINS() { cxLeftWidth = -1 };
     // Get a handle to the window
     var hwnd = GetActiveWindow();
     // Set properties of the window
     // See: [url]https://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx[/url]
     SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
     // Extend the window into the client area
     See:https://msdn.microsoft.com/en-us/library/windows/desktop/aa969512%28v=vs.85%29.aspx[/url]
     DwmExtendFrameIntoClientArea(hwnd, ref margins);
     //#endif
 }
开发者ID:AllanUnity,项目名称:Unity_Sample,代码行数:14,代码来源:TransparentWindow.cs


示例15: Form1

        public Form1()
        {
            //MessageBox.Show(Environment.Is64BitOperatingSystem.ToString());
            // check os
            Version v = System.Environment.OSVersion.Version;
            double ver = v.Major + v.Minor / 10.0;

            if (ver <= 6.0)
            {
                MessageBox.Show("This software only run on Windows 7 or later!!!");
                Environment.Exit(0);
                return;
            }

            if (!IsRunAsAdmin())
            {
                // Launch itself as administrator
                ProcessStartInfo proc = new ProcessStartInfo();
                proc.UseShellExecute = true;
                proc.WorkingDirectory = Environment.CurrentDirectory;
                proc.FileName = Application.ExecutablePath;
                proc.Verb = "runas";
                try
                {
                    Process.Start(proc);

                }
                catch(Exception ex)
                {
                    // The user refused to allow privileges elevation.
                    // Do nothing and return directly ...

                }

                Environment.Exit(0);  // Quit itself
                return;
            }
            InitializeComponent();
            if (DwmIsCompositionEnabled())
            {
                MARGINS m = new MARGINS();
                m.Right = m.Bottom = -1;
                m.Left = m.Top = -1;// this.Width + this.Height;
                DwmExtendFrameIntoClientArea(this.Handle, ref m);
            }
            bgWorker = new BGWorkReport(ReportProcess);

            backgroundWorker1.RunWorkerAsync();
            this.BringToFront();
        }
开发者ID:zhaojunlucky,项目名称:Audio,代码行数:50,代码来源:Form1.cs


示例16: DwmExtendFrameIntoClientArea

 public static int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins)
 {
   var hModule = LoadLibrary("dwmapi");
   if (hModule == IntPtr.Zero)
   {
     return 0;
   }
   var procAddress = GetProcAddress(hModule, "DwmExtendFrameIntoClientArea");
   if (procAddress == IntPtr.Zero)
   {
     return 0;
   }
   var delegateForFunctionPointer = (DwmExtendFrameIntoClientAreaDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DwmExtendFrameIntoClientAreaDelegate));
   return delegateForFunctionPointer(hwnd, ref margins);
 }
开发者ID:maxschmeling,项目名称:flamecage,代码行数:15,代码来源:Win32.cs


示例17: ExtendGlassFrame

        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if (!DwmIsCompositionEnabled())
                return false;

            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            // Set the background to transparent from both the WPF and Win32 perspectives
            window.Background = Brushes.Transparent;
            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

            MARGINS margins = new MARGINS(margin);
            DwmExtendFrameIntoClientArea(hwnd, ref margins);
            return true;
        }
开发者ID:pointgaming,项目名称:point-gaming-desktop,代码行数:15,代码来源:HomeWindow.xaml.cs


示例18: ExtendGlassFrame

        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            if (!DwmIsCompositionEnabled())
                return false;

            IntPtr hwnd = new WindowInteropHelper(window).Handle;
            if (hwnd == IntPtr.Zero)
                throw new InvalidOperationException("The Window must be shown before extending glass.");

            window.Background = Brushes.Transparent;
            HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
            MARGINS margins = new MARGINS(margin);
            DwmExtendFrameIntoClientArea(hwnd, ref margins);

            return true;
        }
开发者ID:eugene-blokhin,项目名称:WinLinker,代码行数:16,代码来源:AeroGlassHelper.cs


示例19: Library

 public Library()
 {
     InitializeComponent();
     Transition.run(this, "Opacity", 1.0, new TransitionType_EaseInEaseOut(600));
     int val = 2;
     if (Environment.OSVersion.Version.Major > 5)
     {
         DwmSetWindowAttribute(this.Handle, 2, ref val, 4);
         MARGINS m = new MARGINS();
         m.cxLeftWidth = 0;
         m.cxRightWidth = 0;
         m.cyBottomHeight = 0;
         m.cyTopHeight = 1;
         DwmExtendFrameIntoClientArea(this.Handle, ref m);
     }
 }
开发者ID:ptx-console,项目名称:cheetah-web-browser,代码行数:16,代码来源:Library.cs


示例20: SetAreoArea

 public static bool SetAreoArea(IntPtr ptr, ref MARGINS margins)
 {
     try
     {
         int hr = DwmExtendFrameIntoClientArea(ptr, ref margins);
         if (hr < 0)
         {
             return false;
         }
     }
     catch (DllNotFoundException)
     {
         return false;
     }
     return true;
 }
开发者ID:wykoooo,项目名称:copy-dotnet-library,代码行数:16,代码来源:Desktop.cs



注:本文中的MARGINS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MATRIX类代码示例发布时间:2022-05-24
下一篇:
C# MARC类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap