Sign in to follow this  
Selacius

[.net] "Refreshing" Event Code

Recommended Posts

What exactly do you mean by refresh/reload? There's the Refresh method on the control, which just repaints it. If it's your own UserControl, you could just add a public Reload() method on the control, and call that from your event handler, then do whatever you need to inside the Reload method.

Share this post


Link to post
Share on other sites
Okey, this is wat I have. A user control for my explore procedure. Using code from previous, I draw the map as a graphics and display it in a picturebox. Now on this user control I also have 4 buttons (north, south, east, west). The player is located at the center of the map, and when one of the buttons is pushed, the location moves. Now, I could have the buttonclick events for each button redraw the tile that the player had occupied and move the player to the new tile. But because of the way I have things setup, the player is always in the middle of the map, and its just the boundaries change. It's always a 7x7 or so viewing area. So I need a way that I can click the button, and the onclick event refreshes the user control to redraw the map.

Share this post


Link to post
Share on other sites
Yeah, it sounds like you want to call Refresh or Invalidate on the user control then. If the buttons are declared inside the user control then call this.Invalidate inside the click handlers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this