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

Control Scaling???

I have 2 controls on a page that need to be defined by absolute horiz. and
vert. sizes, and both need to be a percentage of the screen size. Does anyone
know of a easy way to grab the screen extents, divide them by fractions that
can then be assigned to the controls on initialization.

I am working in C# in ASP.Net!

--
D @ premierdata
Nov 19 '05 #1
3 1503
Hi Dewright,

Welcome to ASP.NET newsgroup.
As for the grabing the screen size of clientside in asp.net page, here are
some of my suggestions:

Since the screen size is the clientside information, currently we could
only retrieve it through clientside scripts. The problem is that clientside
scripts need to be executed at clientside (browser context), so we need to
at least let our page be render to client once to get those info. Since
you need to get the screen size so as to coordinate your serverside
control's size, I think we have the following means:

1. We retreive the clientside screen size in client script and also use
client script to modify our server control's size( through the attributes
of the controls' rendered html elements at client)

2. We use client script to get the screen size and post back to server
again and adjust the control's size in serverside code. This'll need an
additional roundtrip to clientside.

Here is a web link which provide the clientscripts on how to get the screen
size at clientside;

#Screen Size
http://www.javascripter.net/faq/screensi.htm

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 19 '05 #2
Great stuff, you are always a great source of info. To go along with this
then is there a easy way to take these values from the Javascript and add
them to my session variables? I will pass them from page to page to scale the
individual controls appropriatley.

Thanks Steven!

"Steven Cheng[MSFT]" wrote:
Hi Dewright,

Welcome to ASP.NET newsgroup.
As for the grabing the screen size of clientside in asp.net page, here are
some of my suggestions:

Since the screen size is the clientside information, currently we could
only retrieve it through clientside scripts. The problem is that clientside
scripts need to be executed at clientside (browser context), so we need to
at least let our page be render to client once to get those info. Since
you need to get the screen size so as to coordinate your serverside
control's size, I think we have the following means:

1. We retreive the clientside screen size in client script and also use
client script to modify our server control's size( through the attributes
of the controls' rendered html elements at client)

2. We use client script to get the screen size and post back to server
again and adjust the control's size in serverside code. This'll need an
additional roundtrip to clientside.

Here is a web link which provide the clientscripts on how to get the screen
size at clientside;

#Screen Size
http://www.javascripter.net/faq/screensi.htm

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Nov 19 '05 #3
Thanks for your sincere reply,

I'm very glad that my suggestion was of assistance. As for the further
question you mentioned, I think we can consider the following approach:

Since you said that you'll retrieve this information just at the first time
the user visited the application and then cache them in Session, I think we
can makeing a particular page which is used to collect such clientside
information. So when the user visit our web application, we can check the
session state( or maybe a flag in cookie) which indicate whether we've
cached the user's clientside info or not. If not, we store the current
requested page's address and then redirect to the particular page the
particular page collect the information through those client scripts
mentioned in former message and postback to store the collected info into
session. After that , the user is redirected to the originally requesting
page.

How do you think of this? Please feel free to let me know if you have any
other questions or ideas.

Thanks & Regards,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)





Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colin | last post by:
Hi, It seems vs.net does some automatic scaling in the ide. like if i take a project develloped under 96 dpi low res and load it under 120 dpi hi res it does all kinds of automatic resizing. this...
1
by: susie_richie_30 | last post by:
Hi, I am trying to apply gray scaling to color as well as black/white images. I have tried using the pixel by pixel approach to achieve the scaling. But the particular approach has a issue with...
0
by: Steven | last post by:
Hello, I have a problem in scaling printing. I use standard print dialog. When I click the button of "Property" in this dialog, it shows the printer's property dialog. As usual, there is a...
0
by: Steven | last post by:
Hello, I have a problem in scaling printing. I use standard print dialog. When I click the button of "Property" in this dialog, it shows the printer's property dialog. As usual, there is a...
1
by: DEWright_CA | last post by:
Hello Everyone! I am curious if anyone has done anything so automate the scaling of controls based on screen resolution. In my case I have a minimum screen res of 1024x768 for my page size,...
3
by: Larry Serflaten | last post by:
I am taking a 256 color bitmap from a file and scaling it up X 16 to a 32bppPARGB bitmap in memory. I copy that image to the screen. After scaling, the edges of all the lines and colors are...
2
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
4
by: xDrDoSx | last post by:
does any one have good tutorials or articles on PHP and database scaling?
0
by: igalep132 | last post by:
Hey all, I was trying to resize control size to the form size. I'm changing my form size according to current Screen Size by using Screen.PrimaryScreen.WorkingArea; and then I'm making a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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,...

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.