众家智慧,实时资讯


Google
 
  热门搜索: 北京酒店 移民 香港旅游 网上交友
标签:microsoft.com
时间:

Discuss client application development using Windows Forms controls and features.

2
Wed, 17 Sep 2008 10:

 I'm not too experienced at this and am hoping for some help.

 

So far I don't have a lot of code, as I've only been trying little snippets to see what results I get. I'll paste some of the stuff and I am sure someone will be able to give me some guidance.

 

The following code is where I want to put a heading in a rectangle, and be able to use a formula to position the text in the centre of the page and the rectangle. You will note I've used stringSize.Height*2 which just gives more white space in the rectangle, but I then have to position the text by trial and error, both to get it to the centre of page and rectangle.

 

PrivateSubPrintDocument(ByValsenderAsObject,ByValeAsPrintPageEventArgs)HandlesPrintDocument1.PrintPage

DimgAsGraphics = e.Graphics

 

DimblackPenAsNewPen(Color.Black, 2)

DimdrawFont1AsNewSystem.Drawing.Font("Arial", 14, FontStyle.Bold)

DimdrawBrushAsNewSystem.Drawing.SolidBrush(System.Drawing.Color.Black)

DimdrawHeadingAsString="TREASURERS REPORT"

DimstringSizeAsNewSizeF()

stringSize = g.MeasureString(drawHeading, drawFont1)

g.DrawRectangle(blackPen, 20.0F, 20.0F, frmWidth, stringSize.Height * 2)

g.DrawString(drawHeading, drawFont1, drawBrush,NewPointF(frmWidth - stringSize / 2, 30))

2
Wed, 12 Jul 2006 05:

ok.. another question please..

is there a way to capture a panel and save it as a jpg pic..

"note" the panel contains drawings.

 

thnx


2
Wed, 17 Sep 2008 01:

I have a situation (Windows Form) that I have being trying to determine the best way to manage. In VB.NET 2005&2008, there is a nice feature that allows a developer to manage application settings (using my.settings). One has the ability to manage set the scope of the variable to User or Application. For user settings I have no issues. However, it is the application settings that are my issue.

Due to the requirements of my application, I need to have a process in place that will allow an admin person to change the values of the application setting variable. As it stands now, I would have to make the changes in my development environment and then recompile the application, then releasing to production. I want to avoid this and still maintain the ability to use such statements as my.settings.conString. 

Ideally, I am thinking that I can create a program that will allow me to read the variables from any my.settings file and list all the variables in a list box. Then as a user selects the various variables, they can then change them as desired.

I do not want to use the app.config file because I have to know the variable name, unlike my.settings showing me all the possible variables I can use. I had considered creating my own“ini” file, but I would like to solution to work with all of my windows applications.

Any ides on this would be greatly appreciated.

 

Regards,

Alexander

 

2
Tue, 16 Sep 2008 08:

I'm using a Textbox in C# Windows Forms. I need to show the text formatting to my users, like in Word, where you have a glyph for line breaks, a glyph for tab, and so on.

I thought there would already be a font for that, but I don't know where there's one. Heck, I don't even know what query I should use in Google.

How do I show special characters? Is there a special font I can use for that?

2
Fri, 19 Sep 2008 11:

Is it possible to display context-sensitive help from a .chm or .hlp file on a .NET win forms application?

We want to associate UI controls with placeholders from the chm or hlp file so that if a user invokes the "help" button and then clicks on a
control, the help specific to the control is displayed in a floating rectangle.

Does .NET provide built-in support for this?
HelpProvider opens the CHM file. Instead I want to show the help associated with the control like a tooltip. The help text will not be hardcode in
the program but will come from an existing CHM/HLP file.
I should be able to do something like ContextHelp.AddHelp(txtBox1,4000) where 4000 is the ID of some help text present in the CHM or HLP file.

Thanks,
Yash

2
Mon, 29 Sep 2008 12:

 

Hi,

 

I have big problem here...

 

I have developed VB.Net windows application in VS 2.0.In my PC where i developed my application contain VS 2.0 IDE.

 

Problem is that it runs fine in my PC but when i deployed it in the other Computer ,in which only .Net 2.0 framework is installed, application got crashed.....

 

im frustrated with this uncertain behaviour....

 

I have checked my application for all memory leaks,exception handling..etc..

but i could'nt found the problem....

 

So please help me in this regard...

 

Thankx in adv..

2
Thu, 02 Oct 2008 09:

 

I am adding items to the combobox using the class below ValueDescriptionPair,

 

ComboBox1.Items.Clear()
ComboBox1.Items.Add(New ValueDescriptionPair("1", "One"))
ComboBox1.Items.Add(New ValueDescriptionPair("2", "Two"))
ComboBox1.Items.Add(New ValueDescriptionPair("3", "Three"))

 

And I am getting the selected value using the code below,


Dim str as String = CType(ComboBox1.SelectedItem, ValueDescriptionPair).Value

 

Sometimes I am getting an error below (while getting the data),


Error: Object reference not set to an instance of an object.

 

What is the cause and fix for this? Any ideas?

 

Code Snippet

Public Class ValueDescriptionPair
    Public Value As Object
    Public Description As String

    Public Sub New(ByVal NewValue As Object, ByVal NewDescription As String)
        Value = NewValue
        Description = NewDescription
    End Sub

    Public Overrides Function ToString() As String
        Return Description
    End Function
End Class

 

 

2
Tue, 30 Sep 2008 12:

Hi there,

I've recently got Windows Vista Ultimate x64 Edition, and I've immediately tried adding glass to my apps - using this tutorialhere. I followed it to the word, yet glass is not drawn - instead a black background is shown (even if the backcolour is, say, green). If I keep the form as it is, but don't call the method to extend glass into the client area, the part of the form that's supposed to have glass properly shows as 100% transparent.

Also, this guy's tutorial has black where glass should be too. Any ideas what may be going wrong?

Thanks a lot,
- Javawag

2
Thu, 02 Oct 2008 06:

Hello All,

 

I have a UserControl that houses several Panels. Each of these Panels can have controls on them that can fill the entire panel. I would like to implement a drag and drop feature, but the underlying Panels are the only controls that my app knows of (the controls on the panels are setup by the user). How can I catch/forward the drag and drop commands to my underlying panels?  If I just AllowDrop, I never receive any of the Drag commands (DragEnter, DragLeave, etc.), because the controls on the panels are getting/firing the Drag commands.

 

Thanks for the help,

 

- Jon

2
Thu, 02 Oct 2008 08:

Hi,

 

I am using C# 2.0 to compile a Win form. However, themain form seems to open but not be visible when this program begins to run. I have to click its icon from the task bar to make it display.  What causes it and how to fix?

 

Thanks.

2
Thu, 14 Jun 2007 03:

 

Hi...

 

          I am using a third party graph drawing tool to draw the graph part in my application. I want to draw a line in my Mouse left click event of that graph. Every time if i click on the graph that line should get drawn on that point from top point to bottom point on graph. Mouse clickevent of graph wil give me Mouse clicked points. If i am using Graphics.DrawLine function then line is getting erased immediately after drawing.

 

        How i can do this...?

 

Thanks,

IamHuM

2
Sat, 27 May 2006 11:

HI..

I have a list view and it contains some columns - Column1,Column2,Column3,Column4.

Now i want to hide any of the columns if it is visible or unhide the columns if it is already hidden.How can I do this???

Any help is highly appreciated

~nhd

1
Thu, 02 Oct 2008 03:

What is the best way to close a form?  In VBA there is a unload form to clear all the data in the form.  In VB Express I can only see Me.Hide. 

Thanks

2
Thu, 02 Oct 2008 02:

Hi, I am new to C#.Net. I am developing C#.Net windows application. I have used different forms. To switch from one form to another I have used Form's .ShowDialog() property. If I clicked any of control (Say Button) of Form, then form will automatically get closed. But for some forms, it will work fine. But some will automatically get closed. Why? I didn't know the cause?

The form code is like that :

        private void lblArray_Click(object sender, System.EventArgs e)
        {
            Label lblClicked = new Label();
            lblClicked = (Label) sender;

            switch (lblClicked.Name)
            {                
                case "lblEmployeeDetails":
                {
                    frmEmpInfo oFrm = new frmEmpInfo();
                    oFrm.ShowDialog();
                    break;
                }           

                case "lblExit":
                {
                    this.Close();
                    break;
                }
            }
        }      


Does anybody know solution? Thanks in Advance.

1
Thu, 02 Oct 2008 02:

I know is can do a if not isnumeric(txtbx) then ***********

 

but is there a way to check that a value is of type int64?

1
Thu, 02 Oct 2008 05:

Now that SQL Server 2008 supports Heirarchy ID, does anyone have a code example where it is bound to and managed using a tree control?

 

Specifically, I'm looking for all nodes (and subnodes) in the tree control to be checkboxes, with a checkbox being "indeterminate" if the child nodes are a mix of checked and unchecked.

 

We're using LINQ to SQL elsewhere in our project.. would be great if could be used here too.

 

Thanks,
Ron


1
Thu, 02 Oct 2008 05:

Hello all, I am having an issue and would appreciate anyone's help or ideas.

I have some fairly simple VB.Net Windows applications running on PCs connected to the network through 802.11 wireless. 
The applications consist of windows forms. These forms query SQL databases to present data to the user. During a query, if the wireless signal drops or is low my sql connection times out and causes the whole app to lockup. Sometimes it doesnt only kill the app but it basically destroys the whole PC and sometimes it has to be restarted. The apps run flawlessly on a wired connection, no problems whatsoever. 
I was curious if maybe some other developers have had experience with database connections and queries over wireless connections and had any ideas to help improve my problems. 
Thanks in advance!

1
Wed, 17 Oct 2007 04:

Is it possible displaying a transparent picture and/or with alpha channel as watermark in a listview?

Following code shows a normal picture as listview watermark:



Code Block

        [StructLayout(LayoutKind.Sequential)]
        public class LVBKIMAGE
        {
            public int ulFlags;
            public IntPtr hbm;
            public string pszImage;
            public int cchImageMax;
            public int xOffsetPercent;
            public int yOffsetPercent;
        }

        public static void SetLVBackground(ListView LV, string BitmapFileName)
        {
            LVBKIMAGE tLBI = new LVBKIMAGE();

            tLBI.ulFlags = LVBKIF_TYPE_WATERMARK;
            tLBI.hbm = LoadImage(IntPtr.Zero, BitmapFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

            tLBI.pszImage = "";
            tLBI.cchImageMax = 0;
            tLBI.xOffsetPercent = 100;
            tLBI.yOffsetPercent = 100;

            SendMessage(LV.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);
            SendMessage(LV.Handle, LVM_SETBKIMAGEW, 0, tLBI);
            SendMessage(LV.Handle, LVM_SETTEXTBKCOLOR, 0, CLR_NONE);
        }

2
Mon, 29 Sep 2008 11:

Hi,

 

I am designing a windows application that is used to set admin permissions for another (non .NET) application.

 

There are a number of steps involved in setting permissions. Each step is dependent on the previous one.

 

I intend to implement the solution by using "Wizard" like functionaility. i.e. The user will see a first form and set permission. They then press a "Next" button and set permissions in the second screen etc.....

 

Do any of you have alternative suggestions as to how this could be implemented?

 

Thanks,

Kabir

2
Mon, 29 Sep 2008 08:

 

Hi,

 

I have an app that displays text in a scrollable user control. It works fairly well, except for some scrolling issues.  There were a lot of artifacts when scrolling, but I found the following code to include in my class, which fixed most of them:

 

protectedoverridevoidWndProc(refMessagem)

{

// from a forum post by Harold.DeArmas on 4/3/08 "Scrolling 'FullDrag' Artifacts"

// Removes artifacts when scrolling

switch(m.Msg)

{

case0x114:// WM_HSCROLL

case0x115:// WM_VSCROLL

case0x20A:// WM_MOUSEWHEEL

case0x214:// WM_SIZING

case0x5:// WM_SIZE

this.Invalidate();

break;

}

base.WndProc(refm);

}

 

However I still have the following two problems:

 

1.  The scroll wheel on the mouse has no effect.

 

2.  When dragging the thumb with the mouse, the content flickers a lot but does not scroll until I release the mouse, at which point it jumps to the new location. I commented out the line above which selects the case for WM_VSCROLL, and it was a little better in that there was no flicker but also noscrolling until I release the mouse, at which point it jumps to the new location. Any suggestions as to how I can get scrolling to work while the thumb is being dragged.

 

I have already tried the following but it had no effect:

SetStyle(ControlStyles.AllPaintingInWmPaint |

ControlStyles.OptimizedDoubleBuffer |

ControlStyles.UserPaint,true

首页 上一页 下一页 末页
文章内容均为自动聚合而来,不代表本网站赞同其内容和观点. 本页执行时间:2933.189 ms
© 2008 Dig168.com 冀ICP备07502488号
合作伙伴 链接交换
2934.51499939