📄 eurolimitsdialog.h
字号:
this->upperStarsLimits->Items->AddRange(gcnew cli::array< System::Object^ >(8) {L"2", L"3", L"4", L"5", L"6", L"7", L"8",
L"9"});
this->upperStarsLimits->Location = System::Drawing::Point(212, 26);
this->upperStarsLimits->Name = L"upperStarsLimits";
this->upperStarsLimits->Size = System::Drawing::Size(45, 21);
this->upperStarsLimits->TabIndex = 2;
//
// lowerStarsLimits
//
this->lowerStarsLimits->FormattingEnabled = true;
this->lowerStarsLimits->Items->AddRange(gcnew cli::array< System::Object^ >(8) {L"1", L"2", L"3", L"4", L"5", L"6", L"7",
L"8"});
this->lowerStarsLimits->Location = System::Drawing::Point(82, 26);
this->lowerStarsLimits->Name = L"lowerStarsLimits";
this->lowerStarsLimits->Size = System::Drawing::Size(45, 21);
this->lowerStarsLimits->TabIndex = 2;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label4->Location = System::Drawing::Point(139, 29);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(67, 15);
this->label4->TabIndex = 1;
this->label4->Text = L"Upper limit";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label3->Location = System::Drawing::Point(6, 29);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(70, 15);
this->label3->TabIndex = 1;
this->label3->Text = L"Lower limit:";
//
// EuroLimitsDialog
//
this->AcceptButton = this->euroOK;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 246);
this->ControlBox = false;
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->euroCancel);
this->Controls->Add(this->euroOK);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = L"EuroLimitsDialog";
this->Text = L"Set Euromillions Limits";
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->upperValuesLimits))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->lowerValuesLimits))->EndInit();
this->groupBox2->ResumeLayout(false);
this->groupBox2->PerformLayout();
this->ResumeLayout(false);
}
#pragma endregion
private:
int lowerValuesLimit;
int upperValuesLimit;
int lowerStarsLimit;
int upperStarsLimit;
public:
property int LowerValuesLimit
{
int get() { return lowerValuesLimit; }
void set(int limit)
{
lowerValuesLimit = limit;
lowerValuesLimits->Value = limit; // Set as selected in NumericUpDown
}
}
property int UpperValuesLimit
{
int get() { return upperValuesLimit; }
void set(int limit)
{
upperValuesLimit = limit;
upperValuesLimits->Value = limit; // Set as selected in NumericUpDown
}
}
property int LowerStarsLimit
{
int get() { return lowerStarsLimit; }
void set(int limit)
{
lowerStarsLimit = limit;
lowerStarsLimits->SelectedItem = limit; // Set as selected in ComboBox
lowerStarsLimits->SelectedIndex = // Set index for selected item
lowerStarsLimits->FindString(limit.ToString());
}
}
property int UpperStarsLimit
{
int get() { return upperStarsLimit; }
void set(int limit)
{
upperStarsLimit = limit;
upperStarsLimits->SelectedItem = limit; // Set as selected in ComboBox
upperStarsLimits->SelectedIndex = // Set index for selected item
upperStarsLimits->FindString(limit.ToString());
}
}
private: System::Void euroOK_Click(System::Object^ sender, System::EventArgs^ e) {
::DialogResult result;
// get the limits for values
int valuesLower = Decimal::ToInt32(lowerValuesLimits->Value);
int valuesUpper = Decimal::ToInt32(upperValuesLimits->Value);
if(valuesUpper - valuesLower < 4) // Check for an adequate range
{
result = MessageBox::Show(this, // Range insufficient so
"Upper values limit: "+valuesUpper + // display message box
" Lower values limit: "+ valuesLower+
"\nUpper values limit must be at least 4 greater that the lower limit."+
"\nTry Again.",
"Limits Invalid",
MessageBoxButtons::OKCancel,
MessageBoxIcon::Error);
if(result == ::DialogResult::OK) // If message box OK clicked
DialogResult = ::DialogResult::None; // prevent dialog from closing
else // Messag box Cancel clicked
DialogResult = ::DialogResult::Cancel; // so close the dialog
return;
}
// Get stars limits
int starsLower = lowerStarsLimits->SelectedItem == nullptr ?
lowerStarsLimit :
Int32::Parse(lowerStarsLimits->SelectedItem->ToString());
int starsUpper = upperStarsLimits->SelectedItem == nullptr ?
upperStarsLimit :
Int32::Parse(upperStarsLimits->SelectedItem->ToString());
if(starsUpper - starsLower < 1) // Check for an adequate range
{
result = MessageBox::Show(this, // Range insufficient so
"Upper stars limit: "+starsUpper + // so display message box
" Lower stars limit: "+ starsLower+
"\nUpper stars limit must be at least 1 greater that the lower limit."+
"\nTry Again.",
"Limits Invalid",
MessageBoxButtons::OKCancel,
MessageBoxIcon::Error);
if(result == ::DialogResult::OK) // If message box OK clicked
DialogResult = ::DialogResult::None; // prevent dialog from closing
else // Message box Cancel clicked
DialogResult = ::DialogResult::Cancel; // so close the dialog
}
// Store the new limits
lowerValuesLimit = valuesLower;
upperValuesLimit = valuesUpper;
lowerStarsLimit = starsLower;
upperStarsLimit = starsUpper;
}
public:
// Disables controls for selecting upper limits
void SetLowerEnabled(void)
{
upperValuesLimits->Enabled = false;
upperStarsLimits->Enabled = false;
lowerValuesLimits->Enabled = true;
lowerStarsLimits->Enabled = true;
}
// Disables controls for selecting lower limits
void SetUpperEnabled(void)
{
upperValuesLimits->Enabled = true;
upperStarsLimits->Enabled = true;
lowerValuesLimits->Enabled = false;
lowerStarsLimits->Enabled = false;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -