|
What event do i override for the picture box(video viewer) for repainting the picture box?
How do implement the z-order?
Sorry im asking to many questions, i just came into c# im from a java background.
|
|
|
|
|
Orson wrote: What event do i override for the picture box(video viewer) for repainting the picture box?
The Paint event? I'm still unclear as to how the video is being drawn
on your picture box. What control are you using?
Orson wrote: How do implement the z-order?
You can change the z-order of controls on a form using the
Control.ControlCollection.SetChildIndex Method[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Im using the avicap32 and user32 dll's of windows to preview my video from the webcam to my picture box.
The code fragment from different layers on my application that previews the video in the picture is displayed below:
<br />
private void lstVideoSources_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
Device d = DeviceManager.GetDevice(lstVideoSources.SelectedIndex);<br />
d.ShowWindow(this.video_viewer);<br />
}<br />
<br />
<br />
<br />
public void ShowWindow(global::System.Windows.Forms.Control windowsControl)<br />
{<br />
Init(windowsControl.Height, windowsControl.Width, windowsControl.Handle.ToInt32());<br />
}<br />
<br />
<br />
public void Init(int windowHeight, int windowWidth, int handle)<br />
{<br />
string deviceIndex = Convert.ToString(this.index);<br />
deviceHandle = capCreateCaptureWindowA(ref deviceIndex, WS_VISIBLE | WS_CHILD, 0, 0, windowWidth, windowHeight, handle, 0);<br />
<br />
if (SendMessage(deviceHandle, WM_CAP_DRIVER_CONNECT, this.index, 0) > 0)<br />
{<br />
SendMessage(deviceHandle, WM_CAP_SET_SCALE, -1, 0);<br />
SendMessage(deviceHandle, WM_CAP_SET_PREVIEWRATE, 0x42, 0);<br />
SendMessage(deviceHandle, WM_CAP_SET_PREVIEW, -1, 0);<br />
<br />
SetWindowPos(deviceHandle, 1, 0, 0, windowWidth, windowHeight, 6);<br />
}<br />
}<br />
Im trying out what you said...
|
|
|
|
|
Can i send you the entire code through your mail box please?
|
|
|
|
|
I just noticed something. I tried to change the z-order and position(left,top) on the click event of the picturebox, but each time i click on the picture box while the video is on it, nothing happens. but when i stop the video(i.e when picturebox is now like normal without images) and click on the picturebox the action specified in the click event takes place.
I feel the video is like a different layer on top of the picture box.
Another important note is that the video also works on a panel.
|
|
|
|
|
Orson wrote: I feel the video is like a different layer on top of the picture box
In a way, it is. You won't be able to draw on the top of live video because
every new frame gets drawn on top of whatever you draw there. Changing the z-order
will not help here - VFW still just draws to the screen.
To get around this, you need (ideally) to be able to draw on a video frame before
it is drawn to the screen. This will prevent the flicker associated with redrawing
any overlay over the top of every video frame on the screen.
With VFW, capSetCallbackOnVideoStream() can help.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hey guys..anyone knows a good website to download .x models to use with directx 9?
thank you
|
|
|
|
|
|
|
thanks guys..but maybe i should have mentioned i want FREE sites ?:P
|
|
|
|
|
How about here[^]? You can easily convert these into .X models using a model converter.
|
|
|
|
|
thanks man
|
|
|
|
|
Hi,
Sorry about my english at first.
i am doing mobile education project in CF. while students solving questions, they must solve questions with using touchpad only. (not use of paper) I showed questions in a picturebox(1 question per 1 picturebox. For every question there is forward button.) But at the solution process i dont want to change image of picturebox (re-usable) so i think about a layer for paperwork only. and also if student moved on to other question,the paperwork thing must exist also (if student want to come back to question.).
is there a way to edit or add picturebox for a layer?
(C#-Visual Studio 2005-CF)
Quiet important thanks
modified on Tuesday, January 22, 2008 8:38:48 AM
|
|
|
|
|
I noticed that I'm not the first person to ask this question. "levgiang" has also asked a similar question.
What would be the recommended ways of saving a series of computer generated bitmap (frames) to an animated file format. I'm creating a series of computer generated bitmaps/images and I would like to find an expedient way of saving the frames in a popular animation file format so that the entire series can be independently viewed in a generic windows media player.
As a follow up question, what would be the recommend ways of reversing this process, where I retrieve an animated file into a C# or VB program so that the individual frames can be separated out for further processing.
I'm currently teaching myself Visual Studio Express 2005 using VB and C#.
BTW, would it help to upgrade to Visual Studio 2008?
Thank you for your help!
Steve
www.OrionWorks.com
www.zazzle.com/orionworks
|
|
|
|
|
Hello.
How would I make my game draw a new Texture2D that goes the way the right analog stick is facing when the right trigger is down? (think Geometry Wars, etc.) I have the things needed for the stick (enum direction) and trigger (bool isRightTriggerDown), but I don't understand how to draw the new sprites, or atleast how to make them move seperately than each other in different directions. Would I use a for loop to draw how many is needed, or what. Help would make me very happy. Thanks for reading, at least. (and in advance)
- I love D-flat!
|
|
|
|
|
Hi all,
When I call IDirect3DDevice::BeginScene method, the returned error is D3DERR_SCENE_IN_SCENE.
Please tell me how to fix this.
Thank you.
|
|
|
|
|
Just a guess: I suppose you'll get this error when you call BeginScene twice without having called EndScene in between.
|
|
|
|
|
Yes, the problem is when I change the screen solution, something wrong happens and prevents the EndScene() call. So when the next BeginScene is called, it returns this error.
This is fixed. Anyway, thank you very much for your answer
|
|
|
|
|
Is it possible to use DirectX to render a 3d scene to a Bitmap instead of to a screen?
Using C# .Net 2 on XP.
It's not really suitable to put the render code into the paint event and then repeatedly call this.DrawToBitmap , so is there another way? Rendering to the Window is fine but so long as I can get the last rendered scene to a Bitmap (without having it re-render).
The reason I need the bitmap is because the image needs to be used again, such as in other windows (without having a bunch of near-identical and wasted devices). I suspect this may involve use of Surfaces?
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
ive developed program using opengl with C for image processing operations and i run the code using visual studio.everything was working good for 256x256 images.but when i use images of more pixel size ...im having trouble with Fourier transformation.
if anyone know how to solve the error i will mail the code as it is lengthy...
|
|
|
|
|
kanika wrote: im having trouble with Fourier transformation.
Um, it would help if you said what kind of trouble.
kanika wrote: everything was working good for 256x256 images.but when i use images of more pixel size
Does the Fourier transform routine you're using have a requirement that the image size be a power of 2 and the larger images you're feeding it don't conform?
Believing in bullshit doesn't make it true.
|
|
|
|
|
yes,fft have to check the image size to power of 2.my code have 3 windows orginal image,source image and destination.when i give images less than 256x256 or more than 256z256 i cld get the output...but the image is disturbed in the related windows.
|
|
|
|
|
kanika wrote: when i give images less than 256x256 or more than 256z256 i cld get the output...but the image is disturbed in the related windows.
Is there a fundamental limit to image size for the routine which might be 256x256? It's kind of a suspicious since it represents 64k pixels which is the limit for an unsigned 16 bit integer.
Believing in bullshit doesn't make it true.
|
|
|
|
|
Hello. It may seem like a beginner question, but I'd like to know how to draw a line. Simple? I've been looking all over the net, and through these books I have, (also CodeProject) and nothing "works". Please help, thanks in advance.
- I love D-flat!
|
|
|
|
|
Hi,
for the Form, Panel, or whatever Control you want to draw on, use the OnPaint handler
(or add a new handler to the Paint event); it will give you a PaintEventArgs offering
a Graphics object, then use Graphics.DrawLine() and the like.
If you need examples, there are plenty around at CP. My Sokoban article also has some
line drawing.
[ADDED] just noticed some essential info got hidden in the subject line;
for XNA things are a bit more complicated, but they do provide some documentation,
so this may help[^].
[/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
modified on Sunday, January 13, 2008 5:03:32 PM
|
|
|
|