|
Is there also a way to loop through the pixels in VB?
Thank you
Michael
|
|
|
|
|
hello
tried to make a screencapture of a panel with controls on it and "connections" at the background (created using paint() procedure). DrawToBitmap does only the visible part of the panel, so i came up with the following code after a while. problem is that the invisible part of the panel turns up black in the resulting jpeg picture. Does anyone have any suggestions for me?
public static void CreateScreenCaptureFile(Control ctrl, string path)
{
// get dimensions (part may be invisible)
int w = 0,h = 0;
foreach(Control c in ctrl.Controls )
{
if(c.Left + c.Width > w) w = c.Left + c.Width + 100;
if(c.Top + c.Height > h) h = c.Top + c.Height + 100;
}
if(w == 0) w = ctrl.DisplayRectangle.Width;
if(h == 0) h = ctrl.DisplayRectangle.Height;
// create bitmap
IntPtr hwnd = ctrl.Handle;
Bitmap b = new Bitmap (w, h);
Graphics bg = Graphics.FromImage (b);
IntPtr bgdc = bg.GetHdc ();
SendMessage(hwnd , WM_PAINT, (int)bgdc, 0);
SendMessage(hwnd, WM_PRINT, (int)bgdc, (int)(
DrawingOptions.PRF_OWNED |
DrawingOptions.PRF_CHILDREN |
DrawingOptions.PRF_CLIENT)
);
bg.ReleaseHdc();
bg.Dispose ();
// save the result jpeg file
b.Save(path, ImageFormat.Jpeg);
b.Dispose ();
}
|
|
|
|
|
jVersteegen wrote: the invisible part of the panel turns up black
There's no way to get "invisible part" because it doesn't exist.
Invisible parts, by definition, are invisible - they don't get drawn.
Why are you sending a WM_PAINT message? You can't do that - the system
should send that message, not you, and it's not doing anything useful
in your code.
What if you add the PRF_NONCLIENT drawing option to your WM_PRINT message?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry for the late reaction, i had given up hope on any reactions....
adding PRF_NONCLIENT does not change anything.
is there any way to change the background color to white?
thanks!
|
|
|
|
|
joost.versteegen wrote: is there any way to change the background color to white?
Paint white on bgdc before doing the WM_PRINT.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks! I will try later, time to go home now...
have a nice weekend!
cheers
|
|
|
|
|
joost.versteegen wrote: have a nice weekend!
Thank you! You too!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,
i have drawn a cube in tao framework in c#.i want to draw a big container(truck) and some small packages(boxes ).These boxes will be packed in the big container.The color of the boxes should be of different colors pertaining to a particular customer.Plz help me out.
regards
aurosikha
|
|
|
|
|
hi all.
i have some problem in using directx to show 3d model in windows.
1.I loaded some .x file in c# and want to rotate them.but there is some problem .when a object rotate some of it's side disappear.
2.problem is that how can i set center of my object for rotate object around it not around Coordinate System .
3.when i assign some bitmap on my object it repeat many time on object surface.
i want to it cover all of my object no tile on it.
its code:
device.Transform.World =
Matrix.Scaling(handle.XScale, handle.YScale, handle.ZScale) *
Matrix.RotationZ(Geometry.DegreeToRadian(handle.ZRotate)) *
Matrix.RotationY(Geometry.DegreeToRadian(handle.Yrotate)) *
Matrix.RotationX(Geometry.DegreeToRadian(handle.XRotate)) *
Matrix.Translation(handle.X, handle.Y, handle.Z);
for (int i = 0; i < handle.MeshMaterial.Length; i++)
{
device.Material = handle.MeshMaterial[i];
device.SetTexture(0, handle.MeshTexture[i]);
handle.mesh.DrawSubset(i);
}
handle is my object that contains my 3d info.
sepel
modified on Wednesday, September 24, 2008 3:18 AM
|
|
|
|
|
anyone have links, magazine articles, book titles, or open source project references
question 1:
what are some algorithms available to simulate how ms word draws each page as i scroll through 1000+ page document. Assuming the whole document cannot be loaded+drawn in memory all at once. How does the buffering work?
Realistically i'll be rendering a printed circuit board that might have many circles, rectangles using filled polygons. If the user zooms in, a given polygon might border the canvas and outside region. how would this partially on screen object be drawn? Should i send my canvas containing perspective+coordinate to all the objects and have the actual objects draw themselves to the canvas. Each shape will need to know how to partially render itself.
are there any advanced articles in this subject?
question 2:
what are some algorithms for
snapping to grid,
when connecting components how auto route lines (shortest route + no overlapping.)
thanks,
-lm
|
|
|
|
|
I need some 3D Models ( cars, people, trees etc. )
Where can I download them from and use them LEGALLY in my applications.
My applications are non-commercial. But I may upload them in codeproject.
Thanks in Advance.
|
|
|
|
|
I forgot to mention. I don't want to pay for the models.
|
|
|
|
|
AmitDey wrote: I don't want to pay for the models.
Of course.
You didn't say what formats but here are a couple of links I've been sitting on for years.
3D Archive[^]
Great Buildings[^]
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
I want format supported by XNA (.fbx)
But I can convert 3D Studio (.3ds) , DirectX (.x) file using blender to .fbx
|
|
|
|
|
a design that is simple but can make others shock when they see it..
anyone.. pls help me..
|
|
|
|
|
Black font on black background - shockingly simple.
Or what about mintgreen font on pink background, frame and title bar in all rainbow colours... nausea guaranteed.
|
|
|
|
|
Hey everyone, do you know particle deposition?it is an algorithm used to create 3D models. By any chance,does anyone here knew bout this algorithm?thanks
|
|
|
|
|
hello friends,
how can i make a simple, soft and nice brush like that is in the microsoft paint?
My solution was to draw consecutive circles in my mouse drag event and add them to the array list and then repaint all circles in the array list. but some of the events of mouse drag are missed and this make my brush dotted. i want to know how can i make it more smooth. please guide me.
thanks
|
|
|
|
|
You can use a pen instead. First adjust the width of your pen. Then set StartCap and EndCap of the pen to LineCap.Round. Finally draw lines, instead of 'points', from the previous point to the current point, in the mouse move event.
|
|
|
|
|
|
The best way to handle this situation is to use an interpolation function to create a curve that smoothly joins the input points of the mouse.
The easiest pseudo sample is below, but you can expand it to use bicubic or any spline function.
void DrawPoint( double x, double y )
{
...paint single brush dab.
}
void DrawLine( double x0, double y0, double x1, double y1, double spacing )
{
double dx = x1-x0;
double dy = y1-y0;
double dist = sqrt( dx * dx + dy * dy );
dx *= 1.0 / dist;
dy *= 1.0 / dist;
for ( double p = spacing; p <= dist; p+= spacing ) {
double px = x0 + p * dx;
double py = y0 + p * dy;
DrawPoint( px, py );
}
}
void MyPaintCode( )
{
for ( int i = 0; i < NumberofPoints; i++ ) {
PaintLine( Input_x[ i ], Input_y[ i ], 1.0 );
}
}
|
|
|
|
|
Hey guys
So today a bought a webcam, now i want to capture the video, or rather for starters just display the feed on a panel.
Ive googled till im blue in the face(and will continue after posting this), i simply cant find a MINIMALISTIC article or tutorial on how to do this. From what I've read i need to use DirectShow...
Can someone please help?
Thanks
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
You can certainly use DirectShow although you've got to love COM to do it and the documentation sucks. If you're using XP, an alternative is OpenCV[^] which probably has the functionality you want built in. If you're using Vista, the capture parts of OpenCV are broken because they use VFW and that's not supported on Vista, although the camera display parts are ok since they're DirectShow based. There's a very active OpenCV group on Yahoo, if you get interested.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
Google for "Windows Image Acquisition webcam".
|
|
|
|
|
Advertising is expressly forbidden in the forums. Buy advertising space like everyone else. That alone will make you far more legitimate than stealing free space in a forum.
|
|
|
|