0 امتیاز

سلام

چطوری میتونم یه فرم شیشه ای مثل فرم زیر بسازم؟

منبع عکس

بسته شده

1 پاسخ

+1 امتیاز
 
بهترین پاسخ

با زدن دکمه F7 به محیط کدنویسی برین و در بالای سازنده فرم کدهای زیر رو بنویسین :

 

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        //The DLL statement
        [StructLayout(LayoutKind.Sequential)]
        public struct MARGINS
        {
            public int Left;
            public int Right;
            public int Top;
            public int Bottom;
        }

        //The DLL statement
        [DllImport("dwmapi.dll", PreserveSig = false)]
        static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS
        margins);

        //The DLL statement
        [DllImport("dwmapi.dll", PreserveSig = false)]
        static extern bool DwmIsCompositionEnabled();

        //Add the code directly
        protected override void OnLoad(EventArgs e)
        {
            if (DwmIsCompositionEnabled())
            {
                MARGINS margins = new MARGINS();
                margins.Right = margins.Left = margins.Top = margins.Bottom =
        this.Width + this.Height;
                DwmExtendFrameIntoClientArea(this.Handle, ref margins);
            }
            base.OnLoad(e);
        }

        //Add the code directly
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            if (DwmIsCompositionEnabled())
            {
                e.Graphics.Clear(Color.Black);
            }
        }

        public Form1()
        {
            InitializeComponent();
        }
    }
}

فضای نام زیر رو هم اضافه کنید

using System.Runtime.InteropServices;

برنامه رو اجرا و حالشو ببرین:)))

توسط (6,480 امتیاز) 6 17 129

حالشو بردم :))))) smiley 

 

توسط (2,595 امتیاز) 5 15 90
سوال جدید

2,334 سوال

2,871 پاسخ

3,725 دیدگاه

3,915 کاربر

دسته بندی ها

...