Click here to Skip to main content
15,915,869 members
Home / Discussions / C#
   

C#

 
GeneralRe: null issue before initializing object Pin
Colin Angus Mackay17-Mar-05 6:41
Colin Angus Mackay17-Mar-05 6:41 
GeneralRe: null issue before initializing object Pin
Robert Rohde17-Mar-05 7:23
Robert Rohde17-Mar-05 7:23 
GeneralRe: null issue before initializing object Pin
spif200118-Mar-05 2:06
spif200118-Mar-05 2:06 
GeneralReflection in .net Pin
nsainaveen17-Mar-05 1:28
nsainaveen17-Mar-05 1:28 
GeneralRe: Reflection in .net Pin
mav.northwind17-Mar-05 2:08
mav.northwind17-Mar-05 2:08 
GeneralxmlTextWriter Pin
Anonymous17-Mar-05 1:26
Anonymous17-Mar-05 1:26 
GeneralRe: xmlTextWriter Pin
Anonymous17-Mar-05 3:22
Anonymous17-Mar-05 3:22 
QuestionHow can I create the Thumbnail view from the form? Pin
Balu Ramachandran17-Mar-05 1:03
Balu Ramachandran17-Mar-05 1:03 
How can I create the Thumbnail view from the form?
In the following approach we tried but we are facing some limitations to get the thumbnail image of the form alone.

Can anuy one please help how to creat the thumbnail of the form alone.

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?
Even we tried with IClonable Interface's clone method also. Can any body please explain the clone() implementation in detail?

Thanks,
With Regards,


Balu Ramachandran
Generaldynamically design a Tree (Data Structure) by using two or more label’s Pin
tkkiran16-Mar-05 22:35
tkkiran16-Mar-05 22:35 
GeneralSql Backup and Restore [C#.Net] Pin
| Muhammad Waqas Butt |16-Mar-05 22:23
professional| Muhammad Waqas Butt |16-Mar-05 22:23 
QuestionHow to know/identify that installation is done from the application Pin
Shiby16-Mar-05 21:40
Shiby16-Mar-05 21:40 
AnswerRe: How to know/identify that installation is done from the application Pin
Christian Wikander16-Mar-05 22:40
Christian Wikander16-Mar-05 22:40 
GeneralRe: How to know/identify that installation is done from the application Pin
Shiby16-Mar-05 23:58
Shiby16-Mar-05 23:58 
GeneralRe: How to know/identify that installation is done from the application Pin
Christian Wikander17-Mar-05 1:23
Christian Wikander17-Mar-05 1:23 
GeneralRe: How to know/identify that installation is done from the application Pin
Shiby17-Mar-05 18:01
Shiby17-Mar-05 18:01 
GeneralMicrosoft Office Pivot Table 9.0 component in asp.net Pin
Prabhakar.A16-Mar-05 20:00
Prabhakar.A16-Mar-05 20:00 
GeneralTree view Pin
salmanhasan16-Mar-05 18:15
salmanhasan16-Mar-05 18:15 
GeneralDelegates Pin
Anonymous16-Mar-05 18:13
Anonymous16-Mar-05 18:13 
GeneralRe: Delegates Pin
leppie16-Mar-05 20:25
leppie16-Mar-05 20:25 
QuestionHow can I detect a blank image Pin
Robert Wandell16-Mar-05 17:31
Robert Wandell16-Mar-05 17:31 
AnswerRe: How can I detect a blank image Pin
MoustafaS17-Mar-05 2:05
MoustafaS17-Mar-05 2:05 
AnswerRe: How can I detect a blank image Pin
Dave Kreskowiak17-Mar-05 5:29
mveDave Kreskowiak17-Mar-05 5:29 
GeneralArrayList Pin
la vie16-Mar-05 16:28
la vie16-Mar-05 16:28 
GeneralRe: ArrayList Pin
S. Senthil Kumar16-Mar-05 18:00
S. Senthil Kumar16-Mar-05 18:00 
GeneralRe: ArrayList Pin
Christian Wikander16-Mar-05 22:50
Christian Wikander16-Mar-05 22:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.