1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
SelectedIndex = comboBox1->SelectedIndex;
Projectile1.setProjectile(SelectedIndex);
Invalidate();
Update();
}
// Display the chosen Projectile
public:
virtual void OnPaint(PaintEventArgs^ e) override {
Form::OnPaint( e );
Graphics^ g = e->Graphics;
g->SmoothingMode = Drawing2D::SmoothingMode::HighQuality;
switch(Projectile1.Type){
case 'Rect':
g->DrawRectangle(Pens::Black, Projectile1.ProjectilePos.X, Projectile1.ProjectilePos.Y, Projectile1.width, Projectile1.height);
g->FillRectangle(Brushes::Red, Projectile1.ProjectilePos.X, Projectile1.ProjectilePos.Y, Projectile1.width, Projectile1.height);
break;
case 'Circ':
g->DrawEllipse(Pens::Black,Projectile1.ProjectilePos.X, Projectile1.ProjectilePos.Y, Projectile1.width, Projectile1.height);
g->FillEllipse(Brushes::Red, Projectile1.ProjectilePos.X, Projectile1.ProjectilePos.Y, Projectile1.width, Projectile1.height);
break;
}
}
|