473,796 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1524
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
1629
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 is undesirable, how do you turn it off? I have a function that scales forms on the fly (form param). but now i realize that changing the dpi messes up the scaling. i need to take the dpi into consideration but the formulas i've tried don't scale...
1
1826
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 high mega pixel images. Is there any other approach that can be applied to achieve the gray scaling and also have a reasonable performance?
0
1281
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 function of "scaling" in the printer's property dialog. But how can I get the value of this "scaling" in C#.net? Could you tell me the method? Thanks.
0
1216
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 function of "scaling" in the printer's property dialog. But how can I get the value of this "scaling" in C#.net? Could you tell me the method? Thanks.
1
1240
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, which I designed to, but I know a lot of people are now using 1280+ and am looking for any examples of ways to in code behind do something like this. if (screen.width < 1024) {
3
2561
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 blurred. I want the edges all crisp, including inherent pixelation (jaggies). Setting smoothing to none, or adjusting the composting mode on the Graphics object still
2
5908
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 commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set of context menu items. Thanks.
3
4524
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 runtime control to anchor properly? Second -- the program I'm writting is supposed to look like a dos application (long story). When the application is "Normal" aka a small window then everything looks great. But when I resize the window to...
4
1785
by: xDrDoSx | last post by:
does any one have good tutorials or articles on PHP and database scaling?
0
1438
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 resizing to my form. but the main problem is how to resize controls which are embedded to the form ? after googeling and trying some kind of things, i got that the main problem of control resizing is control's font scaling. any idea how to scale the font...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.