PC Review


Reply
Thread Tools Rate Thread

How to create the thumbnail view from the form?

 
 
=?Utf-8?B?QmFsdSBSYW1hY2hhbmRyYW4=?=
Guest
Posts: n/a
 
      17th Mar 2005
How can I create the Thumbnail view from the form?
In the following approach I tried but Iams facing some limitations to get
the thumbnail image of the form alone.

Plaese any one can help in this regard. It is a serious problem for me.
Thanks!

Approach - I - Bitmap (screen capture method)
=============================================
Can able to create the thumbnail image using Bitmap and BitBlt.

Code Sample:
Graphics g1 = this.CreateGraphics();
Image MyImage = new
Bitmap(this.ClientRectangle.Width,this.ClientRectangle.Height, g1);
Graphics g2 = Graphics.FromImage(MyImage);
IntPtr dc1 = g1.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width,
this.ClientRectangle.Height, dc1, 0, 0, 13369376);
g1.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
MyImage.Save(@"c:\BaluCaptured.jpg", ImageFormat.Jpeg);
MessageBox.Show("Finished Saving Image");



Limitations Facing:

1) Not able to capture the non visible portion of the form.
2) If the specified region size is beyond the visible portion in the
screen, then remaining portions are in black color.


Approach - II - Metafile

Can able create the image using Metafile approach. How can we create the
metafile for user controls drawn objects (Example: Graphs, Gauges).


Graphics grph = this.CreateGraphics();
IntPtr ipHDC = grph.GetHdc();
Metafile mf = new Metafile(@"d:\TestBalu.emf", ipHDC, EmfType.EmfPlusDual);
//grph.ReleaseHdc(ipHDC);
//grph.Dispose();
grph = Graphics.FromImage(mf);
grph.DrawRectangle(Pens.Blue, 10, 10, 100, 120);
Point p1 =new Point(20,60);
Point p2 =new Point(40,80);
Point p3 =new Point(100,120);
Point p4 =new Point(120,260);
Rectangle re=new Rectangle(30,20,60,90);

grph.DrawBezier(Pens.Gold, p1,p4,p3,p2);
grph.DrawBezier(Pens.Gold, p2,p4,p3,p2);
grph.Dispose();


Limitations Facing:

1) This can be possible for regular Graphics objects like creating
Rectangle, Ellipse... using System.Drawing class.
2) It is not supporting for 3rd Party controls like Dundas gauge controls.
When we try to create the metafile (emf) the file size shows 0KB. It is
not writing the data in to the file.


Approach – III – Scale down the Form
How to clone the form which contains the graphics objects like rectangle,
user controls?
When we are trying to clone, it is only referring the memory; it is not
actually cloning the object.

Code Sample:
Form2 obj = new Form2();
obj.Width = 640;
obj.Height = 480;
obj.BackColor = Color.Green;
obj.Show();

Form obj1 = new Form2();
obj1 = obj;
obj1.MaximizeBox = false;
obj1.MinimizeBox = false;
obj1.ControlBox = false;
obj1.FormBorderStyle = FormBorderStyle.None;
obj1.Scale(0.2f, 0.2f);
obj1.Show();

Limitations Facing:
In .net we don’t have direct clone method to clone the form object. How can
we clone the form object?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change OpenFileDialog View (default to Thumbnail view) Jason Microsoft VB .NET 0 14th Sep 2006 12:09 PM
Change OpenFileDialog View (default to Thumbnail view) Jason Microsoft Dot NET 0 13th Sep 2006 04:01 AM
DEP Crashes Explorer when trying to view/create thumbnail of AVI f =?Utf-8?B?QmVu?= Windows XP Video 0 20th Nov 2004 06:49 PM
Thumbnail, how to set folder view=thumbnail =?Utf-8?B?b21lbA==?= Microsoft Windows 2000 0 26th Aug 2004 09:01 AM
View contact photo thumbnail in address card view Tim Lucas Microsoft Outlook Form Programming 1 3rd Jul 2004 01:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:33 PM.