就是网吧那种,不是用windows自带的lock,自己写的程序在弹出登陆界面那个时候,是锁定计算机的,怎么用c#代码实现,或者给我想法也好,不用直接贴代码,
我现在已经有个登陆界面了,我觉得应该是在form初始化完后进行的操作,有人指教否?在线等,给个算法也好,我自己实现去。。说穿了就是网吧那个功能。

解决方案 »

  1.   

            [System.Runtime.InteropServices.DllImport("user32.dll")]
            static extern bool SetForegroundWindow(IntPtr hWnd);        private void Form1_Load(object sender, EventArgs e)
            {
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                
                this.ShowInTaskbar = false;
                this.TopMost = true;
                this.timer1.Interval = 1;
                this.timer1.Enabled = true;
                this.WindowState = FormWindowState.Maximized;
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                SetForegroundWindow(this.Handle);
            }
      

  2.   

    设置login在所有窗体最前面
    SetForegroundWindow
    private void button1_Click(object sender, EventArgs e)
    {
      IntPtr hWnd1 = FindWindow(null, "主窗口标题");   
      SetForegroundWindow(hWnd1);
    }
      

  3.   


    namespace WindowsApplication1
    {
        public partial class Log : Form
        {
            
           private string connectionString = "Data Source = 192.168.1.102; Integrated Security = SSPI;database = netManager";
            private SqlConnection myConnection;
            //适配器
            private SqlDataAdapter da;        //数据集
            private DataSet ds = new DataSet();
            //数据表
            private DataTable LogTable;
            //数据行
            private DataRow LogRow;
            private string StrSQL = "select * from UserTable";
            public Log()
            {
                InitializeComponent();
                this.myConnection = new SqlConnection(connectionString);
                this.da = new SqlDataAdapter(this.StrSQL, this.myConnection);
                this.ds.Clear();
                this.da.Fill(ds, "UserTable");
                this.LogTable = ds.Tables[0];   
            }        private void logButton_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < LogTable.Rows.Count; i++)
                {
                }
            }
        }
    }
    怎么加?我加不正确
      

  4.   

    搞定了。。thks.
    new了一个form出来作为背景嘿嘿