Discuss client application development using Windows Forms controls and features.
Discuss client application development using Windows Forms controls and features.
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.PrintPageDimgAsGraphics = 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))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
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
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?
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
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..
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?
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
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
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
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.
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
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
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.
ThanksHi, 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.
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?
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
Hello all, I am having an issue and would appreciate anyone's help or ideas.
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:
[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);
}
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
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 scrollingswitch(m.Msg){
case0x114:// WM_HSCROLLcase0x115:// WM_VSCROLLcase0x20A:// WM_MOUSEWHEELcase0x214:// WM_SIZINGcase0x5:// WM_SIZEthis.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:
ControlStyles.AllPaintingInWmPaint |ControlStyles.OptimizedDoubleBuffer |ControlStyles.UserPaint,trueSetStyle(