Display Message on status bar in windows application using C#


private void StatusBarMessgeDisplay()
        {
            // Create a StatusBar control.
            StatusBar statusBar1 = new StatusBar();
            StatusBarPanel pnl1 = new StatusBarPanel();
            StatusBarPanel pnl2 = new StatusBarPanel();

            pnl1.BorderStyle = StatusBarPanelBorderStyle.Sunken;
            pnl1.Text = "Welcome On My Status Bar ";
            pnl1.AutoSize = StatusBarPanelAutoSize.Spring;

            // Display the second panel with a raised border style.
            pnl2.BorderStyle = StatusBarPanelBorderStyle.Sunken;
            pnl2.ToolTipText = "Today is : " + System.DateTime.Today.ToLongDateString();
            // Set the text of the panel to the current date.
            pnl2.Text = System.DateTime.Today.ToLongDateString();
            pnl2.AutoSize = StatusBarPanelAutoSize.Contents;
            sbar.ShowPanels = true;
            sbar.Panels.Add(pnl1);
            sbar.Panels.Add(pnl2);
            this.Controls.Add(sbar);
        }

Comments