How do I change images with buttons in .vb? - visual-studio

I'm coding a turn-based battle game and I cannot figure out how to make a button show a certain image on a different form on visual basic. This is my code if it helps:
Form1.plyrs_sprite = Image.FromFile

Why don't you just create a new form with just the desired image and open it up when the button is pressed e.g. the new picture is in form3
me.hide()
form3.show()

Related

How is this popup message created / programmed?

I recently noticed the following popup message ("6 occurrences replaced") in Qt Creator (3.4.2).
I like its style and want to use it in my own application. But how is it done? Is this a particular widget or what else? Can someone point me in the right direction.
You could create your own window with round corners like that with text in the middle paid show it when you want too make the window so it takes a parameter text and you can add different text each time and show

Change the colour of WinJS.UI.BackButton (Win 8.1 back button)

I'm getting started with Windows 8 App development using WinJS. I'm using the Light UI theme but I have set up a darker area on the left of the page (where the black back button is) and the issue is: you can't see the button.
I've trawled through the MSDN pages and the most I could find is how to style a button which doesn't actually explain how to change the colour of an actual asset.
http://msdn.microsoft.com/en-us/library/windows/apps/jj835822.aspx
I've also tried adding: win-ui-light and win-ui-dark classes to the button with no success.
I wondered if someone could point me in the right direction?
Many thanks for your time
Chris
First of all you have to delete the link tag that contain UI css by default and add it to document head , Dynamically.see below code :
var uistyle;
// call when your app load or resume.
function onappopen(){
uistyle = document.createElement('link');
uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";
uistyle.rel = "stylesheet";
uistyle.id = "UIstyle";
document.head.appendChild(uistyle);}
// call when you want to change UI Style.
function UIstyle(UIbool){
if(UIbool=='light'){ uistyle.href = "//Microsoft.WinJS.2.0/css/ui-light.css";}
else {uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";}}
Like: UIstyle('light'); for light UI in Windows 8 or "UIstyle()" for dark;
I used the DOM Explorer to find the buttons default values and overwrite them. It was the child element that needed to be overwritten: .win-back

How to create a background to keep button on it using resource editor

I am new to work on resource editor i have created two buttons next and previous to change the page in my own created window using CreateDialog function and resource editor.
Now i want to create a strip which i will put at the bottom of my window and I want to put the two buttons "NEXT" and "PREVIOUS" on that strip and that strip can be coloured (not be white). I want to do so because right now my buttons are on the display of image on my created window and which looks odd so i want my buttons to appear on the colourful strip(just like as you can see for .pdf files preview on preview pane) .
Any ideas how to accomplish it ?? I tried to use "COUSTOM CONTROL" option from the toolbox and wanted to colour it and wanted to put button on it but when i run the programme i found that before i had an image display at preview pane but now it is not working(i mean on putting the "COUSTOM CONTROL" on my IDD_MAINDIALOG the preview of the image don't work any more which was working before but when i put "MFC BUTTON" (just to check if it works or not ??)on my IDD_MAINDIALOG then it works(i mean there is no problem in dispaying the image on my window which had stopped working due to "COUSTOM CONTROL") )
So any ideas how to accomplish this strip creation ??
Maybe it would be easier to put the image inside a picture control rather than putting the buttons inside a strip.

xna wp7-trying to get a texture2d from photoChooser

in my optionMenuScreen the user picked a poto and then pressed back to the mainMenu and then playGame.
when i'm trying to get the photo in the gamePlayScreen after pressing the back button, its null again.
OptionsMenuScreen photo = new OptionsMenuScreen();
PhotoTexture = new Texture2D(ScreenManager.GraphicsDevice, 50, 50);
PhotoTexture= photo.photoRecieved;
PhotoTexture = Texture2D.FromStream(ScreenManager.GraphicsDevice, photo.PhotoResult.ChosenPhoto);
PhotoPosition = new Vector2(650f, 150f);
1. do i have to go straight to the next screen without back button or do you have another solution? what can i do to make it work?
2. how to enable the user to crop the picture as he wishes to the size i define?
help!!!
thanks alot
Please include the code for the Photo Chooser; you haven't actually included the code that is your issue, which is why your having this problem :-)
Check that you haven't actually disposed the photo that was taken; in this scenario you can just test with a static variable to hold the texture between the two classes.

How to use designer view in Visual Studio to design more than one state of the form?

Is this a stupid question? I am trying to navigate the mystical world of C# Visual Studio. I want to be able to replace a panel at some point in run time, but the designer view only has a static view of a single state of the form.
For instance there could be panel1 on the form, with button1 and picturebox1. Then, if the users presses button1, panel1 will be replaced with panel2. Panel2 has button2 and picturebox2.
I know how to make panel1 on the designer just fine. Isn't there some way I can use the designer to make panel2? Can you only use the designer to make one state of the form and then you have to do any other state by hand?
I don't know of any method to display different states of the form in the designer. It does however sound as if what you want do is two different user controls. I would suggest that you create one form that can shift between two user controls in the code.
It's not exactly what you asked for but at least now you don't have to code the different panels outside of the designer.
This is what you'll need to do:
UserControlPanel1 and UserControlPanel2 where you design the different layouts of your views.
PanelLoaderForm where you leave room for loading the different user controls. Depending on your needs you can implement code to show the different user controls.
This is VB.NET but the code in your PanelLoaderForm could look something like this:
Private Sub LoadUserControl()
If UsePanel1 Then
Controls.Add(new UserControlPanel1())
Else
Controls.Add(new UserControlPanel2())
End If
End Sub
Then if you want to shift between the two call Controls.Remove(oldControl) or something before adding the new one.
I haven't used the C# form designer specifically, but in general you design the initial state of the form, and do the rest (all the dynamic changes) in the code. Now, it might be possible to put panel2 on the form, make it invisible, and just toggle the visibility of panels when button1 is pressed, but most likely this wouldn't be a good solution.

Resources