|
Hi,
I want to implement a preview area which i want it to have a proportional size to the display resolution.
I have a workspace which is a form which is docked fill to my main window.
This is my panel size adjust function:
private void AdjustLayoutEditorSizeToDisplay(int width, int height)<br />
{<br />
int panelHeight;<br />
<br />
Console.WriteLine("Display size: " + width + " x " + height);<br />
Console.WriteLine("tpLayout size: " + this.Size.Width + "x" + this.Size.Height);<br />
Console.WriteLine("regionPanel initial size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
int percent = Utility.PixelsToPercent(this.Size.Width, width);<br />
Console.WriteLine("The provided width is " + percent + "% of the maximum percentage.");<br />
<br />
if (percent > 100)<br />
{<br />
int diff = percent - 100;<br />
panelHeight = Utility.PercentToPixels(height, 100 - diff);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
else<br />
{<br />
panelHeight = Utility.PercentToPixels(height, percent);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
regionsPanel.Size = new Size(this.Size.Width, panelHeight);<br />
Console.WriteLine("regionPanel final size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
}
I provide the resolution and suposly it will make the panel adjust its width to the workspace width and the height propotional to that.
But i found a problem, when docked, a panel seems to keep its original Size property and so it will not give me a correct proportion and it will not adjust its width to the workspace width.
WEll.. can somebody tell me if there is a turn around for this?
Thx,
Nuno
|
|
|
|
|
I am using C# and SQL 2005
for Web application How can I use TextChange event to the textbox to find the given data is exist in data base or not? Please give me an example.
please help me.
Laxmi
laxmi
|
|
|
|
|
You're asking a very top level question. The answer is, you handle the event, postback on it ( which is nasty ) and make a database call. If you can't conceptualise it on a level that's closer to the problem than that, then you shouldn't be undertaking this task.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thru AJAX you can achive this without postback
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Thank you very much for your mail. Some of the sites having this feature.
I dont know what is the code inside. But in my project i want to implement that type of code. Please give me an example by using postback. I dont know much about ajax.
Thank you
Laxmi R
laxmi
|
|
|
|
|
enakku intraikku time ayiduchi..Naan naalaikku solli kodukkiren..sariyaa
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
okey bye
see u tom.
Laxmi
laxmi
|
|
|
|
|
Change the properties of AutoPoatback = true
Then double click on textbox in design mode
you will get
protected void TextBox1_TextChanged(object sender, EventArgs e)<br />
{<br />
}
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
|
Hi,
I did as it is. But I want when press tab in T1
(textbox1) it check database whether the given data
in T1 is exist or not? if exist it give message like
already exist and it again wait for data there (T1)
only. once we are giving data which is not in the
database, then it moves to next field.
according to your logic it checks database. not
only that if we press tab it gives msg. and it
comes to next field. again we come back to T1 and
press tab with out changes, this time it won't give
any msg also.
Please help me.
with Thanks
laxmi
|
|
|
|
|
Hi,
I did as it is. But I want when press tab in T1
(textbox1) it check database whether the given data
in T1 is exist or not? if exist it give message like
already exist and it again wait for data there (T1)
only. once we are giving data which is not in the
database, then it moves to next field.
according to your logic it checks database. not
only that if we press tab it gives msg. and it
comes to next field. again we come back to T1 and
press tab with out changes, this time it won't give
any msg also.
Please help me.
with Thanks
laxmi
|
|
|
|
|
Good Day Sir/Maam:
I have a very simple question thats been bugging me ever since.
Clicking on the maximize button, the FORM (Window) will maximize, but the objects on will not.
Say I have a text box and a command button. If I hit maximize, the form will maximize but the text box and command button will just stay as is.
Is there anyway that they will maximize proportionaly?
Regards,
Ian
|
|
|
|
|
Hello,
You have to use the Anchor property of the controls.
All the best,
Martin
|
|
|
|
|
hi,
this is due the the anchor property of the controls.
by default they are anchored to the top left of the form or the containing control. if you want to maintain the same size then you can set the anchor all the anchor properties of that control. or you can even use dock property.
just play around with these two properties and you will know what works best for you.
if you want, you can even create an event handler to handle the layout event which is fired when ever the layout of the control is changed.
hope this helps.
regards
|
|
|
|
|
Hello experts,
I'm using Serialization to store a collection, and retreive it from a file.
However, there are times in my application that a single item inside a collection should be written/read.
I'm currently marking my collection class, and all the items classes it stores with the Serializable attribute.
I'm using a BinaryFormatter and a FileStream to serialize it.
How can I update the file without writing the entire collection again and again?
Thanks in advance,
Shy.
|
|
|
|
|
I have to do a modification in our software,
see our software sends messages,
So, i want to modify like this, Suppose there is folder in which whenever a text file is being dumped then
software regularly checks that folder and when a file arrives it send to a particular address.
the file name is the destination address,
is there any way to do this?
plz help me. any similar code like this in any website then give me address, i want in c#, but if any other lang, then also no matter.
|
|
|
|
|
Have a look at FileSystemWatcher class
|
|
|
|
|
i saw ur articals but there is no article like filesystemwatcher?
|
|
|
|
|
He doesn't meant to search in his articles.
The link is allways in his Signature.
Very confusing off corse.
Try searching on the CP articles[^]
Or msdn doc[^]
All the best,
Martin
|
|
|
|
|
Hi all, I make a code to drag a text from a list to textbox but i want to insert it in a certin postion in the textbox how can i get the cursor position
merwa
|
|
|
|
|
Hello,
I think the SelectionStart property is what you are looking for.
All the best,
Martin
|
|
|
|
|
Hello merwa,
Martin is right, the mouse position has nothing to do with what you're trying to do, however if you're sure you want to get the mouse position, use e.Location for e is an automatically created mouse event argument for your control "textbox int this case"
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi, is there a way to use an enum as condition in an if statement. Say for example can I change the following code and use enum instead /thx:
string houseType = string.Empty; //is set to different housetypes
...
...
if(housType.Equals("detached house"))
..do something
else if(houseType.Equals("manor"))
..do something else
|
|
|
|
|
Sure:
enum HouseType {UNKNOWN, DETACHED, ... }
HouseType myHouse=HouseType.UNKNOWN;
...
if (myHouse==HouseType.DETACHED) ...
...
Now if you want enum values that are not valid identifiers, you need some special
trick, e.g. add Attributes to each enum value, and retrieve them using reflection.
|
|
|
|
|
Many thx Luc
|
|
|
|