2009-01-14 25 views
11

में स्टेटसस्ट्रिप का उपयोग System.Windows.Forms.StatusStrip पर विचार करें। मैंने अपने विंडोज़ फॉर्म एप्लिकेशन में स्टेटसस्ट्रिप जोड़ा है, लेकिन मुझे कुछ समस्याएं आ रही हैं।सी #

मैं बायीं तरफ एक लेबल लगाऊंगा और स्टेटसस्ट्रिप में दाईं तरफ एक प्रगति पट्टी लेना चाहूंगा, लेकिन मुझे इन गुणों को सेट करने का कोई तरीका नहीं मिल रहा है।

मैंने सोचा कि मुझे दो स्टेटस स्ट्रिप्स बनाने और फ़ॉर्म के निचले हिस्से के दोनों तरफ एंकर करने की आवश्यकता हो सकती है ... वह बाहर नहीं था; इसके अलावा, यह सही महसूस नहीं करता है।

उत्तर

27

लेबल नियंत्रण पर संपत्ति को True पर सेट करें और आपको जाने के लिए अच्छा होना चाहिए।

+7

यदि आप ऐसा करते हैं तो आप लेबल के डिफ़ॉल्ट संरेखण को मध्य केंद्र से बाएं केंद्र में बदलना भी चाहते हैं। –

+0

आप दोनों के लिए धन्यवाद ... सही! – Brad

0

क्या आपने प्रोजेरेसबर्टटूलस्ट्रिपइटम की संपत्ति Right पर सेट की है?

+0

संरेखण डिफ़ॉल्ट तालिका लेआउट के साथ अकेले काम नहीं करेगा। –

+0

हां मैंने ऐसा नहीं किया – Brad

7

आपको क्या करना है अपनी प्रगति पट्टी की संरेखण संपत्ति को सही पर सेट करना है। फिर स्थिति स्ट्रिप का लेआउट स्टाइल क्षैतिजस्टैक WithOverflow पर सेट करें।

private void InitializeComponent() 
    { 
     this.statusStrip1 = new System.Windows.Forms.StatusStrip(); 
     this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); 
     this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); 
     this.statusStrip1.SuspendLayout(); 
     this.SuspendLayout(); 
     // 
     // statusStrip1 
     // 
     this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 
    this.toolStripStatusLabel1, 
    this.toolStripProgressBar1}); 
     this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; 
     this.statusStrip1.Location = new System.Drawing.Point(0, 250); 
     this.statusStrip1.Name = "statusStrip1"; 
     this.statusStrip1.Size = new System.Drawing.Size(467, 22); 
     this.statusStrip1.TabIndex = 0; 
     this.statusStrip1.Text = "statusStrip1"; 
     // 
     // toolStripStatusLabel1 
     // 
     this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; 
     this.toolStripStatusLabel1.Size = new System.Drawing.Size(117, 17); 
     this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; 
     // 
     // toolStripProgressBar1 
     // 
     this.toolStripProgressBar1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; 
     this.toolStripProgressBar1.Name = "toolStripProgressBar1"; 
     this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 16); 

    } 

    private System.Windows.Forms.StatusStrip statusStrip1; 
    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; 
    private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1; 
+0

कृपया, भगवान - इसे दृढ़ता से सेट करने का एक तरीका होना चाहिए। :) –

+0

वहाँ है। मैं डिजाइनर कोड दिखा रहा था। बस संपत्ति पैनल में गुण ढूंढें ... –

+1

दरअसल 'संरेखण' संपत्ति 'ToolStripStatusLabel' वर्ग की संपत्ति ग्रिड में उपलब्ध नहीं है (किसी कारण से इसमें' ब्राउज़ करने योग्य (झूठी) 'विशेषता है, कम से कम। नेट 4)। –

2

यह बस अपने वर्तमान लेबल और अपने Progressbar और सच करने के लिए स्प्रिंग गुण सेट के बीच एक और लेबल लगाकर statusStrip के लिए डिफ़ॉल्ट तालिका लेआउट के साथ प्राप्त किया जा सकता।

+0

मुझे क्यों चिह्नित किया गया एक टिप्पणी उपयोगी होगी। –

+0

धन्यवाद - यदि आप एक से अधिक दाएं संरेखित लेबल चाहते हैं तो यह सही उत्तर है। कोई विचार नहीं कि यह क्यों चिह्नित किया गया होगा। –

0

अपना डिज़ाइनर खोलें और सेट करें .toolStripStatusLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;