I am new to C# programming. I am trying to create a memory game which displays random numbers in a matrix in windows form at first. After some time I have to clear the cells and display options for answers on the left panel of screen. Could any one help me how to pause the matrix in form for a while before matrix blanks? I used text boxes to display matrix.
Also, Is there any standard code for matrix format display in C#?
Please help me..
In a Windows Forms project you should use a Timer to create an event after a certain amount of time.
You should not use Thread.Sleep because this will make your GUI freeze.
I'm not too clued up on C# myself but perhaps something like this is what you're looking for?
System.Threading.Thread.Sleep(3000);
this.Refresh();
Worth a try...
Related
I would like to send to another app current frame (number). Is it possible to access it in axWindowsMediaPlayer control?
I didn't see anything about this on axWindowsMediaPlayer control.
But you can use FrameGrabber project to extract frames from a movie.
FrameGrabber is an open-source library written in c# and it is easy to use.
Hope this helps.
This may be an old thread, but I feel like the question did not properly get answered. This may not be the "frame number" but it does give you a "position" of the video that you could pass. I am using it to sync two videos.
This is for a media player that has already been added to a VB form called AxWindowsMediaPlayer1. I am sure something similar can be called in C#
Dim position As Double
position = AxWindowsMediaPlayer1.Ctlcontrols.currentPosition
i designed a game in c# and finished it... but i tried it on my friend's laptop with different screen size and resolution, all my design was in a total mess!!
if there is a way to keep everything (panels, picturebox,buttons,labels,...) in their positions despite the size and resolution of screen!?!?
really need help, my project's deadline is on Monday :(
Use anchors on your controls:
I assume this is a windows form application? If so, you can use docking to maintain positions. Also, the positions should stay the same anyway unless the form is not a fixed size.
So use docking or a fixed sized form.
Also, please make sure to specify what type of GUI framework you're using next time. My answer is incredibly wrong if you're using something other than windows forms.
Aside from docking, another option would be to place all of your objects within a panel, and then center it horizontally and vertically on your resize event. e.g.
panel1.Left = this.Width/2 + panel1.Width/2;
panel1.Top = this.Height/2 + panel1.Height/2;
This will ensure that your applications static contents are always centered, regardless of resolution.
I'm working on a c# wpf app in which I want to do something with audio. the irrklang audio library provides me with a pcm decoded 16 bit byte array.
I want to create a timeline control which shows the waveform along the timeline with an overlaying rectangle which the user can drag and click/drag the left and right side to increase or decrease the selection.
It is used to the trim the audio track. I would like the selected min and max to be databindable, the minimum and maximum value of the total track to be bindable.
To clarify here is an image mockup:
I'm not asking for a complete control but tips and suggestions on how to tackle this are more than welcome. Perhaps solutions like this already exist but so far I haven't been able to find it.
I think I need to tackle: the control (zooming, panning and changing the selection) and drawing the waveform in the control
Thanks in advance,
I think you should check out this codeplex project
http://wpfsvl.codeplex.com/
Refer to Audio WaveForm Drawing Using WPF.
Something based upon WaveFileTrimmerControl.xaml would be useful, it uses related controls PolygonWaveFormControl.xaml & RangeSelectionControl.xaml (links are to the XAML but refer to the CS also). In any case it'd be a good starting point for building a control that exactly meets what you want.
You could override the render method and use primitives which will give possibly better performance; but like anything related to performance I'd try the above approach first which is almost certainly good enough.
i will need to print an "x" according to the coordinates given to me from one of the tables in my database. im probably gonig to use c# to connect to mysql.
i will probably have a winform that is 8.5 x 11 inches (The size of a regular sheet of paper) and i will populate the entire thing with labels of "x" and they will be invisible.
each individual table record will have the coordinates of those labels which should NOT be invisible
the form for every record will show and will print. the printing will be on top of a paper that is actually a physical application itself.
the problem:
how to fill out a physical application using data from a mysql database. (dont tell me that i should be printing the entire app from scratch, the reason this is not possible is because the form is actually TRIPLE paper width (white, yellow, and pink copy), so i cannot print the entire app from scratch, i have to print on top of it.
the question: how do i print "x" at specified regions? is my solution the best way to go or is there a smarter approach?
in case you have no idea what i am talking about, here are some related questions:
ms-access: designing a report: printing text on specific x,y coordinates
Conditional formatting in Access
While labels would offer you the ability to make an X show up I don't feel that having a bunch of hidden labels is the best way.
Does the "application" represent some kind of form? Are you looking to "check-off" boxes using x's and then print this?
I may suggest using GDI+ (drawing) vs using labels.
Consider the following:
Locate the coordinates for your boxes. Then use the drawstring method within an overridden onPaint event-handler for your form or for the panel which may represent your form's canvas.
This article talks about GDI+ and how to draw text as graphics.
http://www.functionx.com/vb/gdi+/objects/fonts.htm
It's my first time trying to make anything really interesting in C# and I was trying to make a simple form or game screen where the user could define a custom resolution/screen ratio etc. or to automatically detect the max screen size/ratio and output? its my first game, so I was wondering if it was possible or if there would be any major issues with such, rather than just setting it to 1366x768 (the resolution of all of my computers).
Thanks in advance for any assistance.
You could enumerate through the default GraphicAdapter's DisplayModeCollection property to find the DisplayMode with the max width/height/aspect ratio.
Something like:
GraphicsAdapter defaultAdapter = GraphicsAdapter.DefaultAdapter;
DisplayMode maxMode = defaultAdapter.DisplayModeCollection[0];
foreach (DisplayMode enumeratedDisplay in defaultAdapter.DisplayModeCollection)
{
//Test enumeratedDisplay against maxMode, setting maxMode to enumeratedDisplay if enumeratedDisplay is better
}
Maybe there's a better way, but that's certainly one way you could find the max.
Or, you could take the same DisplayModeCollection and populate a comboBox of sorts or a list, letting the user choose for themselves.
My apologies if the above code doesn't work in that exact form. I can't test it where I am currently
Just set the PreferredBackBuffer to 1366x768 and if the graphics device can handle that resolution you'll get it. otherwise you'll get something scaled down. the xbox will automatically scale if nescessary to support the television being used as well.