YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


Drawing Tutorial for Visual C++ 2005

 
 

There are a number of tutorials for using Visual C++ 2005 on the Microsoft web page. Unfortunately, there do not appear to be any complete tutorials that walk you through a drawing tucancode.net step by step from beginning to end. The following tutorial does that.

  1. Start up Visual C++ 2005 and from the “File” menu, select “New” and then click on “Project”.

  1. Under “Project types” click on “CLR” and then under “Visual studio installed templates” select “Windows Forms Application”.

  2. Enter a project name and click “OK”.

  3. At this point you will see the Visual C++ IDE window, consisting of a “Solution Explorer” frame with some pre-existing files already in place. You will also see “Form1.h[Design]” window which contains a rudimentary form titled “Form1”.

  4. Right-click anywhere on “Form1” and select the “Properties” item in the context menu. On the right side of the IDE, you will see a table of Form properties.

  5. Click on the “Events” icon on top of the “Form1” properties window (the small thunderbolt). This will list a series of events that you can write event handlers for.

  1. In the box immediately to the right of “Paint” write down the name of the Paint event handler, call it something like “On_paint” and press “Enter”. This will generate the skeleton for the event handler in a new tab titled “Form1.h”. This is the header file that contains all of the class declarations for the Form. The skeleton for the “On_draw” paint handler looks like this:

private: System::Void On_paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {

             }

      the variable “e” is a handle to the Graphics object associated with the form. The Graphics class enables you do draw on Forms.

  1. At this point, you can proceed with any one of the drawing examples given in the Microsoft web page. For example if you go to http://msdn2.microsoft.com/en-us/library/x1d5a9f2.aspx, you will see an example of drawing several shapes. Change the Graphics object handle “e” to “pe” and enter (i.e. copy and paste) the following code in your “On_paint” hander:

private: System::Void On_paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  pe) {

Graphics^ g = pe->Graphics;

   g->Clear(Color::AntiqueWhite);

 

   Rectangle rect = Form::ClientRectangle;

   Rectangle smallRect;

   smallRect.X = rect.X + rect.Width / 4;

   smallRect.Y = rect.Y + rect.Height / 4;

   smallRect.Width = rect.Width / 2;

   smallRect.Height = rect.Height / 2;

 

   Pen^ redPen = gcnew Pen(Color::Red);

   redPen->Width = 4;

   g->DrawLine(redPen, 0, 0, rect.Width, rect.Height);

 

   Pen^ bluePen = gcnew Pen(Color::Blue);

   bluePen->Width = 10;

   g->DrawArc( bluePen, smallRect, 90, 270 );

               }

Then build and run the program.

 

MFC Example

Note:

UCanCode Advance E-XD++ CAD Drawing and Printing Solution Source Code Solution for C/C++, .NET V2024 is released!


Contact UCanCode Software

To buy the source code or learn more about with:

 

 

 

Copyright ?1998-2024 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net