हां, बटनों या किसी ऑब्जेक्ट की सरणी बनाने में कोई समस्या नहीं है। आप उन्हें विजुअल स्टूडियो डिजाइनर में नहीं देख पाएंगे, लेकिन वे ठीक काम करेंगे।
बहुत समय पहले मैंने कैलक्यूलेटर ऐप के लिए UI बनाने के लिए 2-डी सरणी बटन का उपयोग किया था। मैंने लंबे समय तक एचपी -15 सी का इस्तेमाल किया था, और इसे याद किया।
सरणी दृष्टिकोण ठीक काम किया।
Button[] numberButtons=new Button[] { btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btnDecimalPt};
Button[] operationButtons=new Button[] { btnDiv, btnMult, btnSubtract, btnAdd };
foreach (var b in numberButtons)
b.Click += new System.EventHandler(this.Number_Click);
foreach (var b in operationButtons)
b.Click += new System.EventHandler(this.Operation_Click);
// etc
Button[][] allButtons=
{
new Button[] {btnSqrt, btnExp, btn10x, btnPow,btnMultInverse, btnCHS, null, null, null, null},
new Button[] {btnN, btnInterest, btnPMT, btnPV, btnFV, null, btn7, btn8, btn9, btnDiv},
new Button[] {btnLn, btnLog, btnSine, btnCosine, btnTangent, btnPi, btn4, btn5, btn6, btnMult},
new Button[] {btnRoll, btnSwap, btnCLRfin, btnCLX, btnCLR, btnEnter, btn1, btn2, btn3, btnSubtract},
new Button[] {btnInt, btnFrac, btnFix, btnStore, btnRecall, null, btn0, btnDecimalPt, btnNotUsed, btnAdd}
};
// programmatically set the location
int col,row;
for(row=0; row < allButtons.Length; row++)
{
Button[] ButtonCol= allButtons[row];
for (col=0; col < ButtonCol.Length; col++)
{
if (ButtonCol[col]!=null)
{
ButtonCol[col].TabIndex = col + (row * allButtons.Length) +1;
ButtonCol[col].Font = font1;
ButtonCol[col].BackColor = System.Drawing.SystemColors.ControlDark;
ButtonCol[col].Size=new System.Drawing.Size(stdButtonWidth, stdButtonHeight);
ButtonCol[col].Location=new Point(startX + (col * stdButtonWidth),
startY + (row * stdButtonHeight)) ;
}
}
}
पूरी तरह से प्रश्न से संबंधित नहीं है, लेकिन थोड़ा आगे देखकर, आप http: //www.devexpress पर एक नज़र रखना चाहेंगे।कॉम/प्रोडक्ट्स/नेट/कंट्रोल/विनफॉर्म/शेड्यूलर /, अपने आप को लिखने के बजाय कैलेंडर प्लानर के रूप में उपयोग करने के लिए, आप कम प्रयास के लिए इसे अधिक से अधिक प्राप्त करेंगे – RC1140
+1 स्टैकरर: हम उस नियंत्रण का उपयोग करते हैं (अच्छी तरह से पूरे उद्यम सुइट) जहां मैं कुछ महान परिणामों के साथ काम करता हूं। पर्याप्त सिफारिश नहीं कर सका। –