.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

I need to calculate a controll top margin minus the control bottom margin how do i do it?

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Windows Application

I drawed a line using a control.

g.DrawLine(penColor, myControl1.Left,myControl1.Top,myControl1.Left,myControl1.Bottom);

Drawing a green line so if ill change the control size in the designer i will not have to update it all the time in my code.

Now what i want to do is the move this line to the right by 10 pixels.

So i did

g.DrawLine(penColor, myControl1.Left+10,myControl1.Top,myControl1.Left,myControl1.Bottom);

But my problem is i drawed another line on axis X on the control bottom and i need to move the first line by 10 but also take care not only about the green line axis X ( wich i moved by 10 pixels ) but also take care about the green line with the control top margin and bottom marging.

This is the two lines after i added the first one 10 pixels and after i removed minus 10 pixels from the red line:


g.DrawLine(penColor, myControl1.Left+10,myControl1.Top,myControl1.Left+10,myControl1.Bottom);

g.DrawLine(penRed, myControl1.Left, myControl1.Bottom-10, myControl1

View Complete Post

More Related Resource Links

left right margin


Hiii Coders ,

I have created my website. Now what is my requirement is that on higher resolution it should be centralized means margin from both sides should be same.

How can i get it working

plz provide me some code snippet plz

thanx and regards

How do you use a resource as a value for the Margin property?

Hello, How do you use a resource as a value for the Margin property? I have the following resource defined: <Window.Resources> <sys:Double x:Key="AppBorderSize">30</sys:Double> </Window.Resources> I would like to use the "AppBorderSize" resource in the following: <Grid Margin="{StaticResource AppBorderSize}, 0, {StaticResource AppBorderSize}, 0"> However, the above it not allowed. The following work fine: <RepeatButton Width="{StaticResource AppBorderSize}" Height="{StaticResource AppBorderSize}" /> Regards, Robert  

Composite Control: Load Script at bottom?

Is there a way to have an embedded .js file load at the bottom of my page?....I can load it into the header quite easily, but I want it at the bottom :)Regards,Steve

Margin on div removed after async postback with UpdatePanel

Hi I have a series of div's inside an update panel, these divs have a margin-bottom defined in css. In IE8, when I do a async postback these margins are all removed. All the other styles are fine. If I turn on compatibility mode this does not happen. In Google Chrome the margins are maintained correctly after the async postbacks. Any idea why this is happening? -- Christian 

can we set a margin off for only one page while desigining .rdl in BIDS.

can we set a margin off for only one page while desigining .rdl in BIDS...while we set the margin off as 0,0,0,0 it applies for all page of .rdl ,so canot we do it for only one page.?. 

How to set report margin


 Dear all professional,

If exports the report as Excel format, how can I set the page margin in excel as 0.5cm ?




SSRS 2008 export to Excel margin problem

When rendering report from SSRS 2008 with custom margins (let's say 0.5in) into Excel, margins do not export correctly, or do not export at all, thus Excel sets its default margins.

I heard in SSRS 2005 it was not a problem.

Any ideas?

reduce width of right margin in rdlc


how can we reduce the width of right margin in rdlc report




How to calculate data from gridview control ???


Hello friends,

well i want to calculate data from a gridview field, you can see below the structure of my main page:


    <form runat="server">


        <asp:Label runat="server" Text="Result:" ForeColor="Red"></asp:Label>

        <asp:Label runat="server"></asp:Label><br />

        <br />

        <asp:GridView runat="server" AutoGenerateColumns="False" CellPadding="4"

            ForeColor="#333333" GridLines="None" DataSourceID="SqlDataSource1">

            <RowStyle BackColor="#E3EAEB" />

            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />

            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />

            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />

            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />

            <EditRowStyle BackColor="#7C6F57" />

            <AlternatingRowStyle BackColor="White" />


nightandday.master won't margin-right:


So Im using a NightandDay.master as my master page and a minimal master as my custom master page. The Night and day master will not allow the margin-right: css code to stick it seems like there is some code preventing this. Minimal master works just fine. Any help is appreciated.

Its a publishing page FYI

Traditional Chinese text flows into right Margin area when exporting to Word - SSRS 2008 R2



I've a Master Report which contains many sub reports. The page size is 11 X 8.5. I've set the .5 top & bottom margins for the Master page & set .5 left & right margins for all the sub reports.

The report renders fine when exporting to pdf. But while exporting to WORD it didn't show up any margins except left. So I copied just the Master page(for Word) and added an empty text box of size .5 on top & bottom. This work around works fine for English. But for Traditional chinese the text flows into right margin area. Left, Top & bottom margins are fine. And I really don't want to change the sub report settings since it works fine for pdf.

Any help would be appreciated!




Large white space in the right margin of the report



I have a report where I hide or show a set of columns based upon the user selections in the paramters dropdown list. User could select option 1, option 2 or both. Requirement is that if they select option 1 then I need to hide the option 2 related columns. If they select option 2 then I hide the option 1 related columns. The tricky part is that they can also select both options then I need to show both options related columns. Normally I create dynamic column titles and column fields with the IIF statements and show only one set depending upon the selection and adjust the right margin. In this case I need to leave the right margin to the maximum columns width so it could accommodate the selection of both sets of columns.  The issue comes in When they select only one set of columns that leaves some ugly large white space in the right margin which is visible while previewing or printing report. Is there any way to fix this issue? This is SQL server 2005 reporting services.

Thanks for your help.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

In-Depth look at the GridView Control

In the last article we looked at few of the new controls available in Asp.net 2.0. We also talked about Grid View Control which has replaced the Asp.net 1.1 DataGrid control for good. In this article we will examine more features of the Grid View control. In this article we will see some of the common operations that can be performed using the GridView control. Apart from these operations there are many more functions that can be performed on the control and which we will see in the later articles

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend