473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to make diagram fit with in panel?

hey i am trying to build a windows application in .net,i have to draw factorial image inside the panel



Expand|Select|Wrap|Line Numbers
  1.      private void Canvas_Paint(object sender, PaintEventArgs e)
  2.             {
  3.                 start_x = Canvas.Width / 2;
  4.                 start_Y = Canvas.Height / 2;
  5.                 for (int i = 0; i < 400; i++)
  6.                     draw_T();
  7.  
  8.             }
  9.  
  10.      public void draw_T()
  11.             {
  12.                 mypen = new Pen(Color.Green, 2F);
  13.                 my_angle = my_angle + (45);
  14.                 my_length = 100 + (1);
  15.  
  16.                 end_x = (int)(start_x + Math.Cos(my_angle * .0174539676) * my_length);
  17.  
  18.                 end_Y = (int)(start_Y + Math.Sin(my_angle * .0174539676) * my_length);
  19.  
  20.                 Point[] points =
  21.                 {
  22.                     new Point (start_x,start_Y),
  23.                     new Point (end_x,end_Y)
  24.                                 };
  25.                 Point[] points1 =
  26.                 {
  27.                     new Point ((end_x+start_x)/2,(end_Y+start_Y)/2),
  28.                      new Point (end_x+50,end_Y-100)
  29.                                 };
  30.                 start_x = end_x;
  31.                 start_Y = end_Y;
  32.                 Graphics g = Canvas.CreateGraphics();
  33.                 g.DrawLines(mypen, points);
  34.                 g.DrawLines(mypen, points1);
  35.             }
drawing T shape line,then i start to draw another T shape from last end points .But problem is diagram is going outside of the panel.How do i fix drawing inside the panel
Aug 21 '14 #1
0 1046

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: kellydotnetnewbie | last post by:
Does anyone know why, when adding a panel to a web form, the text boxes, labels, buttons, etc. are hidden behind the panel, but drop-down lists are not? Every time I make my panel visible...
6
by: sklett | last post by:
I'm curious... asp:Panel renderes a <div> tag, right? And you can have text in a div tag.... so why not have a Text property for the asp:panel control??
1
by: spamfurnace | last post by:
Hi There. I have a panel that i display to the user after they have entered some data. On that panel is a label which is set to visible = false at design time. If i make the panel visible however...
0
by: Joe Au | last post by:
I create a simple web form with a data grid and a panel control. The code is shown here: <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 120px; POSITION: absolute; TOP: 56px"...
6
by: wandali | last post by:
Hello, I have a problem in finding the status of a panel (visible or not). I have a dropdownlist that associates with a panel in which textbox are embeded in the panel. A client side VBScript is...
6
by: shumaker | last post by:
How do I make a panel control invisible, but still recieve events? I have a panel that I set visible= false, and over it I am using GDI+ to paint a grid of rectangles. It has to be invisble or...
1
by: lodhaakhil85 | last post by:
Hi I'm a newbie to C# and GDI+.I am writing an application that will display some strings from a file on a panel. There are a few of problems I am facing : 1.How do make the panel re-adjust...
2
by: denet iglesias | last post by:
hola: yo quisiera saber como puedo hacer que un panel se ponga transparente poco a poco, pero que ademas se pongan transparentes los controles que estne dentro de el, por ejemplo un picturebox y un...
1
by: gringo | last post by:
All, I have a panel with the graph placed on the coordinate system. I need to make a line which could be moved according to y-coordinate of the mouse cursor over the graph. How can I do it with...
1
by: wajedali | last post by:
Hi, I want to add the transprent Jpanel on to the Jpanel, i had tried with glassPane but setGlassPane(pn); metod is applicable for frame only. Plz give me solution.
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.