Click here to Skip to main content
       

Windows Forms

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: Controls OpacitymemberSoyDesarrollador.net12 Oct '12 - 9:15 
Lo siento, solo hablo español, no uso ni me gusta el idioma ingles.
Soy de américa latina y apoyamos al 100% el uso del idioma español.
 
Te recomiendo usar Google translator..
!Que viva el idioma español.....¡
Saludos.
_______________________
Edward J. Ocando. | Desarrollador | SoyDesarrollador.net
Telefono. +58 (416) 164.34.88 | Edward.Ocando@soydesarrollador.net

GeneralRe: Controls OpacitymvpRichard MacCutchan12 Oct '12 - 9:32 
Yes, but on CodeProject we use English. If that's a problem for you then I am sure there are many Spanish language forums where you will be welcome.
One of these days I'm going to think of a really clever signature.

GeneralRe: Controls Opacitymemberlukeer3 Dec '12 - 21:17 
Es geht nicht nur um Amerika. Hier im Forum akzeptieren wir Englisch als den größten gemeinsamen Nenner.
 
For consistency's sake, we keep the forums English and use Google Translate for in- and output, if necessary.

Ciao,
 

luker

Question.bat execution Or something else?memberJason Sani10 Oct '12 - 9:43 
I used to be able to write bat files in my sleep. now, they are a fuzzy memory. Ok here's the deal, I need a something that I an run on start up or execute via executable, It will open a folder and merge about 50 different .reg files into registry, how ever, I want it to run silently, and no confirmation other then completion.
 
I am sure I can put the files in a .dat and insert from there. any ideas on what I should use?
Throw me a bone. Flame me. I don't mind, as long as you don't mind getting flamed, torched, nuked, back. Suspicious | :suss:
AnswerRe: .bat execution Or something else?memberEddy Vluggen10 Oct '12 - 11:41 
Jason Sani wrote:
Ok here's the deal, I need a something that I an run on start up or execute via executable, It will open a folder and merge about 50 different .reg files into registry, how ever, I want it to run silently, and no confirmation other then completion.
 
I am sure I can put the files in a .dat and insert from there. any ideas on what I should use?

Write a bat-file? Make a list of all the filenames using the dir-command is a matter of looking up the switches. As is importing a reg-file in the registry; KB 82821[^]
  regedit.exe /s myregfile.reg 
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

AnswerRe: .bat execution Or something else?mvpDave Kreskowiak10 Oct '12 - 13:04 
First, this has nothing to do with Windows Forms.
 
Second, you can use the REG IMPORT command in a batch file to import each .reg file. just open a CMD prompt and type REG IMPORT /? for more info.

AnswerRe: .bat execution Or something else?memberRichard Andrew x6410 Oct '12 - 15:01 
Put this into your batch file:
 
for %%a in (*.reg) do regedit.exe /s %%a
 
That should merge all files that end with ".reg".

 

The difficult we do right away...
...the impossible takes slightly longer.

QuestionCrystal reports in visual studio 2010 for wpf applicationmemberpriom2227 Sep '12 - 18:06 
Can anyone post a small wpf project with a simple database table having SAP crystal report? Project must be made in visual studio 2010.Thanks to all.
AnswerRe: Crystal reports in visual studio 2010 for wpf applicationmvpRichard MacCutchan27 Sep '12 - 21:58 
This is not a valid question, no one is going to provide you with a working project on demand. Go and search the CodeProject articles[^] for sampl tutorials and code.
One of these days I'm going to think of a really clever signature.

QuestionStrange Design Problems With Infragistics ControlsmemberKevin Marois26 Sep '12 - 5:41 
I'm working on an existing WinForms application and I am having some weird issues with Infragistics controls in a WinForms app.
 
When I open a form or usercontrol in the project that has Infragistics controls on it, it looks like this.[^].
 
I cannot access any of the controls in the design surface. Clicking does nothing. And, all of the controls appear in the lower area.
 
So I created a new test solution and dropped some Infragisstics controls on and got this[^].
 
Anyone know what's going on?
If it's not broken, fix it until it is

AnswerRe: Strange Design Problems With Infragistics ControlsmemberBillWoodruff10 Oct '12 - 5:37 
You paid big $ for Infragistics; why not use their support forums for this type of question.
 
I'd try and help, but I don't use Infragistics controls.
 
best, Bill
~
Confused by Windows 8 ? This may help: [^] !

QuestionInvoking excel thru a .bat filememberForNow19 Sep '12 - 9:42 
Hi
 
I need some pointer withe following process
 

1) having a .bat file kicked off by the creation or the
Change whitin a .txt file
 
2) the bat file will then cut the data whitin it
And paste it on excel worksheet
 

Any pointers with this or what technology to
Look at e.g object linking (I think object linking
Invokes Microsoft products)
 
Would be helpfully

Thanks in advance
AnswerRe: Invoking excel thru a .bat filememberWes Aday19 Sep '12 - 10:42 
Sure you can invoke Excel trough a batch file but you would not be able to interact with the Excel instance. This sounds more like you want a regular application using a FileSystemWatcher and Excel interop. Or, you might be able to do this from a PowerShell script.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

GeneralRe: Invoking excel thru a .bat filememberForNow19 Sep '12 - 17:15 
For Excel Interop do I need VIsual Studio
GeneralRe: Invoking excel thru a .bat filemvpRichard MacCutchan19 Sep '12 - 21:21 
Well you certainly need some compiled program.
One of these days I'm going to think of a really clever signature.

Question.docx to .pdf conversionmemberMember 857432717 Sep '12 - 3:31 
Is there any way to convert .docx to .pdf, if MS Office not installed on machine??
AnswerRe: .docx to .pdf conversionmemberAndrei Straut17 Sep '12 - 3:52 
Yes, install and use OpenOffice
(To CP members: I know this is my second recommendation to use OpenOffice in so many minutes, but I'm not a spammer. I promise! Laugh | :laugh: )
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.

GeneralRe: .docx to .pdf conversionmemberMember 857432717 Sep '12 - 4:04 
Hello Andrei,
 
Thanks for your reply.
 
Could you please provide me some example??
 
Thanks In Advance.....
GeneralRe: .docx to .pdf conversionmemberAndrei Straut17 Sep '12 - 4:11 
Member 8574327 wrote:
Could you please provide me some example??

No, there are a few well documented ones on the Internet. Google is your friend
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.

QuestionDataGridView Collapse Top BordermemberMark Regal15 Sep '12 - 5:15 
I've got a datagridview with a column header row and some content rows that have top borders, and some content rows that don't.
 
When I scroll the grid, rows that have a top border don't collapse into the column header border and I end up with a double border.
 
What's the easiest way to collapse the border being scrolled either up or down? (Some events fire in only one direction).
QuestionInfragistics UltraGridmemberKevin Marois12 Sep '12 - 5:49 
I'm working with an Infragistics UltraGrid. The Add Row "*" thing is not appearing. Anyone know how to get this to show up?
If it's not broken, fix it until it is

AnswerRe: Infragistics UltraGridmvpAbhinav S12 Sep '12 - 7:37 
There are two solutions given here[^]. One of them might help you.
Windows Phone Apps - XKCD | Calvin | SMBC | Dilbert | Speed Dial

Questionabout c#memberpawan19937 Sep '12 - 2:03 
maine kunjvihar se vada pav liya lekin usne chatni kam di aur bola k kande ka price jyada ho gaya hai kar k tereko chatni milni hi nahi chahiye thi ehsan maan maine de diya
AnswerRe: about c#memberWes Aday7 Sep '12 - 2:21 
This is an English speaking site. It really helps to posted your question in English if you expect an answer.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

GeneralRe: about c#memberEddy Vluggen7 Sep '12 - 2:54 
Yes. And I want two of them. With mayonnaise.
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

QuestionSQL Connection problem in Windows ServicememberMember 799263524 Aug '12 - 0:17 
Hello Sir/Mam
I'm trying connect sql server 2000 in windows service with other system on same network.
there are 4 system connected without any problem. But on other 4 system, it is giving error
on connection open while starting windows service. The error is: "the service on local computer started and then stopped some services stop automatically" etc. Same Connection string working in web service
without any error. But giving problem in Window Service. Is there any Configuration setting of that server or sql server 2000. Any help will be highly appreciated.........
AnswerRe: SQL Connection problem in Windows ServiceprotectorPete O'Hanlon24 Aug '12 - 0:21 
Are you, by any chance, using a trusted connection? When you install a service it, by default, is installed using a specific account - and that account might not be trusted by your database.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: SQL Connection problem in Windows Servicememberdojohansen10 Oct '12 - 5:19 
Could be that, could be a firewall, could be something else.
 
Before trying to fix it though I'd introduce a minimum of logging in the service so in future you don't have to stare blindly at that nearly information-free message: "the service started, and then stopped unexpectedly".
 
It's also nice to have the ability to debug service initialization. To do this, introduce a config setting and put a method like this into your service class:
static void AwaitDebugger()
{
    string s = ConfigurationManager.AppSettings["debug"];
    if (s == null || s.ToLower() != "true") return;
 
    DateTime until = DateTime.Now.AddSeconds(30);
    while (DateTime.Now < until && !Debugger.IsAttached)
        Thread.Sleep(50);
            
    if (Debugger.IsAttached)
        Debugger.Break();
}
 
Now in the service main thread, just insert a call to this method before doing anything else. (Not in the start method that probably simply starts the main thread; you want this method to return immediately as before. But in the thread it starts, you want to wait for a debugger to attach if so configured.) Build, deploy, and debug!
GeneralRe: SQL Connection problem in Windows ServiceprotectorPete O'Hanlon10 Oct '12 - 5:32 
You might want to tell the OP this. I already know how to do this.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

Questionstrategy for correcting the side-effects of using Dock (which ignore Margin settings)memberBillWoodruff14 Aug '12 - 0:08 
Hi,
 
Docking is quite useful in creating UI's, but when you Dock something: the "Margin" property settings of what you Dock are ignored.
 
In the past, I've created several types of UI's where an "outer" Panel's ControlCollection consists solely of identical "inner" Panels, all of the same type.
 
Setting all these "inner Panels" to Dock = Top, or whatever is very useful, but they will all be "jammed together" visually: Any Margin.Top or Margin.Top settings of these inner Panels will be ignored.
 
So far, my strategy for creating a better visual experience has been to use UserControls, not "raw" Panels, for the inner things-that-act-like-Panels:
 
Each UserControl has an "inner" Panel inside an "outer" Panel. Both these have Dock set to 'Fill. By setting the background color of the outer Panel to the same color as its outermost Panel, "the host," and then setting the Padding property of the outer Panel in the UserControl to offset the differently colored inner Panel of the UC:
 
Then, when they get all "jammed together" by docking, you can at least simulate a nice visual effect of space between the Docked inner Panels.
 
A logical question for you to be asking right now is: why not just set the UserControl BackColor to the same color as its host container, and have only one Panel in the UC: while I have done this, the simple answer is that I prefer the more fine-grained control possible (I can create fancier visual effects), by having outer/inner Panels in the UC.
 
I wonder if there is a simpler way to approach this ?
 
I guess in an ideal world ... hah ... we could have an over-load of the Dock mechanism, that you would pass a bool into with a name like "respectMarginSettings" Smile | :)
 
Should I add some links to "before" and "after" small .jpg screen-shots to this question, to make crystal-clear the visual results I am talking about ?
 
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr

AnswerRe: strategy for correcting the side-effects of using Dock (which ignore Margin settings)memberdojohansen10 Oct '12 - 6:01 
I find your question confusing, because I can't recall having seen a single Windows Forms control where the Margin settings actually produce any effect. I've always had to reach for Padding instead. But this does lead to just a quick suggestion: try to use padding instead, and let us know if that works.
QuestionEditingPanel Erasing Top Cell BordermemberMark Regal13 Aug '12 - 19:06 
This maybe academic but here goes anyway...
 
I'm drawing custom borders for a datagridview in the datagridview's paint event, the one in a Windows form. That works fine until I edit a cell.
 
When I edit a cell, the top and left grid borders (which are drawn by me in the grid's paint event) are over-layed by the EditingPanel control of the datagridview class.
 
So the borders disappears and the cell looks like it has only two borders...bottom...and right.
 
I subsequently created a custom column and cell template for the grid but no matter what I've tried so far, I can't get to the event that's overwriting my borders to either have it paint the missing borders themselves, or stop it from overwriting the ones that I'm drawing.
 
It would seem that this type of task needs to be accomplished all the time and I just don't know how...so I'm totally missing the boat on this one.
 
Would someone please let me in on the secret of how to (the proper procedures) for painting custom borders around the datagridview cell I'm editing?
 
The borders should be in alignment with the grid's boarders and have the ability to be drawn in different colors.
 
Please advise and thanks!!!
 
Mark
AnswerRe: EditingPanel Erasing Top Cell BordermemberMark Regal14 Aug '12 - 3:14 
I guess a few hours of sleep help sometimes...I think that this is the way...
 
Private Sub Grid_CellPainting(sender As Object, e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles Grid.CellPainting
Try
 
'Paint the cell if the edit control is visible
If Grid.EditingControl IsNot Nothing Then
Dim g As Graphics = Graphics.FromHwnd(Grid.EditingPanel.Handle)
g.DrawRectangle(Pens.Red, Grid.EditingPanel.ClientRectangle)
g.Dispose()
End If
 
Catch ex As Exception
Debug.print(ex.Message)
End Try
End Sub
QuestionVS2010 Setup and Deployment Project - CommonAppDataFolder for XPmemberMember 269415310 Aug '12 - 9:05 
Hi All,
 
I am trying to create a folder under CommonAppDataFolder during install. It works fine for my Windows7 x64 computer, but the folder does not get created for WindowsXP x86 computer.
 
In Windows7 I get a folder "C:\ProgramData\MyCompany\MyProgram"
In Windows XP I would have expected a folder "C:\Documents and Settings\All Users\MyCompany\MyProgram", but that folder does not get created. On both computers I can manually create the folder with the user I am logged into, so I don't think its a permission thing.
 
In VS Setup Project I create a custom folder using "add special folder" saying that the DefaultLocation is: [CommonAppDataFolder][Manufacturer]\[ProductName], then I set the Property property to "COMMONAPPDATAFOLDER".
Is there something I am missing? Something specific to Windows XP?

AnswerRe: VS2010 Setup and Deployment Project - CommonAppDataFolder for XPmvpDave Kreskowiak10 Aug '12 - 14:19 
It's under C:\Documents and Settings\All Users\Application Data\MyCompany\MyProgram.
 
The Application Data folder is hidden so it won't show up in Explorer unless you turn on "View hidden files and folders". You can still get to it by typing the path in the address bar in an Explorer window.

GeneralRe: VS2010 Setup and Deployment Project - CommonAppDataFolder for XPmemberMember 269415313 Aug '12 - 2:18 
Excellent. That was it. I focused so much attention on Visual Studio, instead of digging deeper into the operating system. Thank You!
AnswerRe: VS2010 Setup and Deployment Project - CommonAppDataFolder for XPmemberictxiangxin13 Aug '12 - 4:03 
you can use inno setup to create your install programme, this little app can do anything if you write a pascal-like script. just find that if the folder is exist and do the sub prog to do the next work.
QuestionWrapping of Data Grid View column [modified]memberukraju5 Aug '12 - 20:58 
Hi, how to wrap DataGrid View column?Even though I set the WrapMode in DefaultCellStyle property of DataGridView to True,still wrapping is not happening.How to wrap the text in grid view column?

modified 6 Aug '12 - 3:51.

AnswerRe: Wrapping of Data Grid View columnmemberMember 908236510 Aug '12 - 12:59 
It doesn't wrap until you move to a new cell and thus complete the edit.
QuestionWindows FormmemberDSPNEOqqq3 Aug '12 - 9:15 
How to create parent form and child form usin c#.
I want to create a parent form and two or three radio buttons should be on parent form, when user click on 1st radio button then a child form should be opened related to 1st radio button and another radio button vice-versa.......
 

Please reply Quickly.........
DSPNEO

RantRe: Windows FormmemberEddy Vluggen3 Aug '12 - 9:30 
Put a button on there, doubleclick;
public void Form1_Button1_Click(object sender, EventArgs e)
{
  using(var myForm = new FormChildWithCoolName())
  {
    myForm.ShowDialog(this);
  }
}
 
DSPNEOqqq wrote:
Please reply Quickly.........

Quickly, quickly Zathras..
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

GeneralRe: Windows Form OTmemberWes Aday3 Aug '12 - 9:41 
Eddy Vluggen wrote:
Quickly, quickly Zathras..

Babylon 5?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012

GeneralRe: Windows Form OTmemberEddy Vluggen3 Aug '12 - 10:01 
Yup Smile | :)
AnswerRe: Windows FormmemberChristian Amado6 Aug '12 - 10:47 
Create your forms, set the parent form as Owner of the child. May be MDI forms can helps too.
 
That's all.
Christian Amado
MCITP | MCTS | MOS | MTA
Olimpia ☆ ★★★
 
Please mark as answer, if it helps.

AnswerRe: Windows Form [modified]memberBillWoodruff11 Aug '12 - 15:27 
Hi,
 
First, I believe that Child Forms should never be used, that they lead to awkward user-interfaces, and the old MDI-architecture, which supported MDIChildForms with "special features," deserves the status of a "dinosaur" skeleton: to be looked at, but not re-animated Smile | :)
 
I think you can get better responses to this scenario if you describe what the function of your proposed use of "Child Forms" are, in relation to their "Parent" Form.
 
Is it possible a Dialog can fit your needs here ?
 
Consider that you create a "Child Form" with code like this in response to some event:
            Form form2 = new Form();
            form2.TopLevel = false; // mandatory for Child Forms
            form2.ShowInTaskbar = false;
            form2.Parent = this;
            form2.Name = "form2";
            form2.Text = "form2";
            form2.Size = new Size(300, 200);
            form2.Show();
            form2.BringToFront();
You now have a Form that is in front of your MainForm, and that, depending on FormBorderStyle, can be moved around so parts of it are invisible, as they extend beyond the DisplayRectangle of the MainForm. Depending on its z-order within the Form ... that is if some other control on the Form has been brought-to-the-front: it could appear "behind" other Controls on the Form.
 
Consider that you create a Form which is not a ChildForm: like this:
            Form form2 = new Form();
            form2.ShowInTaskbar = false;
            form2.Name = "form2";
            form2.Text = "form2";
            form2.Size = new Size(300, 200);
            form2.Show();
            form2.BringToFront();
Now you have a Form you can move anywhere on the screen, depending on the setting of FormBorderStyle, and it will always be visible ... unless you activate the MainForm and bring it to the front, and the MainForm covers part of the second Form.
 
If you wanted this new Form to always remain on top, no matter whether the MainForm was activated, or not: just set the new Form's TopMost property to 'true, while making the sure the MainForm's TopMost property is set to 'false.
 
Another area to investigate, if you are concerned with your new Form always appearing on top, is the use of 'ShowModal(), in contrast to 'Show().
 
Keep in mind that: if your WinForms project opens in the rather standard way by creating an instance of the MainForm in the Program.cs class: that closing the MainForm will always automatically close any secondary Forms created.
 
In either case, if you need to exchange information between the MainForm and ChildForm, or MainForm and/or new, "independent" Form, the issues will be exactly the same: you'll need to keep a reference to the newly created Form in the MainForm ... assuming that's where you'll always create this new Form, whether Child, or "independent;" so: make sure that outside the method that creates the Form (i.e., at Form level scope) you create a reference you can access, like:
            private Form form2;
 
            private void SomeButton_Click(object sender, EventArgs e)
            {
                form2 = new Form();
                form2.ShowInTaskbar = false;
                form2.TopMost = true;
                form2.Name = "form2";
                form2.Text = "form2 within Form class scope";
                form2.Size = new Size(300, 200);
                form2.Show();
                form2.BringToFront();
            }
If you do need access to whatever in the MainForm to whatever in new Form, or vice-versa (data, contents, position, state, etc.): then there are plenty of solutions for how to do that here on CP in the QA forum (it's one of the most frequent questions asked). Hint: expose public properties.
 
... edit 1 ...
 
For example:
 
In the MainForm, create a Public Property that will "expose" the instance of the MainForm you create:
// in the definition of the MainForm Class
//
public static MainForm TheMainForm { get; set; }
//
// then in the MainForm Load event, or after the call to InitializeComponent: set the instance:
ThisMainForm = this;
Once you have done this, you can access anything declared Public on the MainForm, from outside the MainForm, by simply using: "MainForm.ThisMainForm."
 
Warning: this technique should only be used on Forms where you create one instance only ! Why: because a Form-level public static Property is always going to point to one, and only one, instance: if you had multiple instances (heaven help you) of your MainForm, changing some public variable's value there would also change it "globally:" so in all other instances: it would have the same value !
 
For your secondary Forms, you do not wish to use this same technique of a static Form-level Property to enable access to their "public stuff:" because, after all, each instance of a secondary Form is going to have the same controls, the same Public Form-scoped variables, etc., and, at run-time these may take on unique values.
 
But, your MainForm can access every instance of a secondary Form it creates (and everything scoped Public on it) by simply putting it in a unique public variable when it is created.
 
Finally, note there are other "models" for passing information between Forms, including using custom Events, and EventArg data structures: you'll find examples of other approaches, and lots of debate about the different ways of enabling Form to Form interaction in the QA section here on CP.
 
... end edit 1 ...
 
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr


modified 12 Aug '12 - 23:35.

GeneralRe: Windows FormmemberEddy Vluggen12 Aug '12 - 3:43 
BillWoodruff wrote:
First, I believe that Child Forms should never be used, that they lead to awkward user-interfaces, and the old MDI-architecture

..I'd like to see a version of Visual Studio with an SDI-interface. MDI isn't dead, it's merely abused a lot. We'll say the same thing about that Ribbon on a few years Smile | :)
 
BillWoodruff wrote:
I think you can get better responses to this scenario if you describe what the function of your proposed use of "Child Forms" are, in relation to their "Parent" Form.

Good point; when an apparant beginner talks about child-forms, I usually assume (I know, we should check, not assume) that they need to display a dialog, and that they forgot to specify the owner of the form (often confused with the parent).
 
+5 for giving a very elaborate answer that does not only benefit the TS.
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

QuestionWindows Form Application Size Issuememberukraju29 Jul '12 - 19:45 
Hi,I developed a application which contains some panels.my desktop screen resolution is 1280X768.When the same application runs in some other system whose desktop resolution is 1024X768 it is showing in another way.
 
Eventhough I changed the Form and its UI elements size programmatically in the form constructor like below there is no change in their dimensions.
 
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
int screenHeigth = Screen.PrimaryScreen.Bounds.Height;
this.Size = new Size(screenWidth, screenHeigth);
this.Invalidate();
this.Update();

InitializeComponent();
 
this.pnlSi.Size = new Size(screenWidth, screenHeigth);
this.pnlSi.Invalidate();
this.pnlSi.Update();
 
this.pnldjt.Size = new Size(screenWidth, screenHeigth);
this.pnldjt.Invalidate();
this.pnldjt.Update();
 
Anybody please inform me how to resolve this issue?I mean changing the form and its UI elements programmatically at run time as per application running system desktop resolution?Thanks in advance.
AnswerRe: Windows Form Application Size IssuememberSimon_Whale29 Jul '12 - 20:11 
How is it not showing in the correct way? what is the actual issue. All I can see is that you are setting 2 panels and the form to the same size at runtime
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

AnswerRe: Windows Form Application Size IssuememberBernhard Hiller29 Jul '12 - 22:07 
InitializeComponent(); should be the first statement after the constructor. Do you know what happens in that function? A lot of values, among them positions and sizes, are set.
I'd rather use a this.WindowState = FormWindowState.Maximized; in the Form_Shown event. If you want to re-order the elements, you can additionally subscribe to a Resize event, and do that there.
AnswerRe: Windows Form Application Size IssuememberBillWoodruff11 Aug '12 - 15:31 
I believe Bernard Hiller gave you the correct answer (I voted his answer #5, naturally): move the call to InitializeComponent() to before your Form and Panel adjustment code.
 
An edge-case hypothesis could be: the monitors have different aspect ratios, but I doubt that.
 
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 17 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid