473,395 Members | 1,791 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,395 software developers and data experts.

How can I reposition an AutoShape from Excel using vb .net 2005?

The problem goes like this. Initially, when I make a line (autoshape) from vb .net to excel everything is well, but when a line requires a rotation (thru a slope compuation), the line's starting postion is also moved. When I try to look at the the shape's LEFT property, the value is still the same as it was been equated (still the same as P1.X's value). Is there anyway I could get the new value of the LEFT property so I can move my shape to the right coordinate?

A series of line from my code are as follows:
Expand|Select|Wrap|Line Numbers
  1.                 xlApp.Visible = True
  2.                 If DGShapes.Item(3, intCtr).Value = "Line" Then
  3.                     P1.X = (CDbl(DGShapes.Item(4, intCtr).Value)) / 1.5
  4.                     P1.Y = (CDbl(DGShapes.Item(5, intCtr).Value)) / 1.5
  5.                     P2.X = (CDbl(DGShapes.Item(6, intCtr).Value)) / 1.5
  6.                     P2.Y = (CDbl(DGShapes.Item(7, intCtr).Value)) / 1.5
  7.                     dblShape_Length = Math.Sqrt(((P1.X - P2.X) * (P1.X - P2.X)) + ((P1.Y - P2.Y) * (P1.Y - P2.Y)))
  8.                     s_Width = dblShape_Length
  9.                     s_Left = P1.X
  10.                     s_Top = P1.Y
  11.                     s_Height = 0
  12.                     dblSlope = (P2.Y - P1.Y) / (P2.X - P1.X)
  13.                     dbl_Shape_Angle = Math.Atan(dblSlope) * 180 / Math.PI
  14.                     shape_001 = xlWorkSheet.Shapes.AddShape(Core.MsoLineStyle.msoLineSingle, s_Left, s_Top, s_Width, s_Height)
  15.                     shape_001.Line.ForeColor.RGB = RGB(250, 0, 0)
  16.                     shape_001.Line.Weight = 3
  17.                     shape_001.Rotation = dbl_Shape_Angle
  18.  
  19.  
  20.                     shape_001.Left = ? 'These are my probs
  21.                     shape_001.Top = ?
  22.  
  23.                 End If
  24.  
  25.  
PS: DGShapes is a datagridview. I'm working on multiple shapes per entry... INTCTR is my counter.
Nov 15 '10 #1
0 771

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

Similar topics

1
by: barma16 | last post by:
I've hit a bit of a brick wall here, and could use some advice. I have an Access application whose output is a four-tab Excel spreadsheet where three of the four tabs are the result of database...
7
by: Gal Zilberman | last post by:
Hi I've found a code which should work, but it doesn't. Please Help Imports Microsoft.Office.Interop ' Refence in the Class Dim oExcel As New Object Dim oBook As Object Dim oSheet As Object...
1
by: Girish | last post by:
Hi, I want to embed a txt document into an excel using python. Here is my code, but i get an error message =================================================== Traceback (most recent call...
0
by: bebek_tetangga | last post by:
Hello, I'm trying to open a .txt file in Excel using C#. Here is my code: clsWorkbook = clsExcel.Workbooks.Open(dailyPath + "\\070701N.txt", 2, false, 5, "", "", true,...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
0
by: wankhusairi | last post by:
hallo sir .. i am still new on using vb and i have tried to load an excel using a visual basic interface.. but if i wanted to plot my excel data what should i do.. must i cahnge my program on loading...
0
by: DJK | last post by:
Hi everyone, I have created a button in Excel using C#(without using Window form) and i want to perform certain actions on clicking that button. My code is as follows: ...
1
by: rameshmandapati | last post by:
hi i have a problem with Excel. iam adding data to a cell in Excel using java script var excel = new ActiveXObject ("Excel.Application"); but i want image also i search in google i...
1
by: =?Utf-8?B?U2hlZXMgQWJpZGk=?= | last post by:
I read an article on the link: http://support.microsoft.com/default.aspx?scid=kb;en-us;306572 related to reading data from Excel using OLEDB The topic's heading is: How to query and display excel...
7
by: Ramya28 | last post by:
Hi... I need to read and write to an excel sheet with watermark in it by using java.. i can perform the rest of operations i need to on the excel except for watermark image in the output excel.. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.