winforms

how can I change forecolor of a chart label?

柔情痞子 提交于 2021-02-20 18:45:09
问题 how can i change the fore color of the chart labels? here's a screenshot of the chart i tried using the chart1.series[0].FontForeColor = color.white; but the entire chart turns white. 回答1: Try this: this.chart1.BackColor = Color.AliceBlue; this.chart1.ChartAreas[0].AxisX.LineColor = Color.Red; this.chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Red; this.chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.Red; this.chart1.ChartAreas[0].AxisY.LineColor = Color.Red; this.chart1

how can I change forecolor of a chart label?

烈酒焚心 提交于 2021-02-20 18:44:02
问题 how can i change the fore color of the chart labels? here's a screenshot of the chart i tried using the chart1.series[0].FontForeColor = color.white; but the entire chart turns white. 回答1: Try this: this.chart1.BackColor = Color.AliceBlue; this.chart1.ChartAreas[0].AxisX.LineColor = Color.Red; this.chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Red; this.chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.Red; this.chart1.ChartAreas[0].AxisY.LineColor = Color.Red; this.chart1

Give a windows handle (Native), how to close the windows using C#?

点点圈 提交于 2021-02-20 09:27:45
问题 Given a handle of a window, how can I close the window by using the window handle? 回答1: The easiest way is to use PInvoke and do a SendMessage with WM_CLOSE . [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); private const UInt32 WM_CLOSE = 0x0010; void CloseWindow(IntPtr hwnd) { SendMessage(hwnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } 回答2: Not sure if there is another way but you could PInvoke

How I Retrieve Data from SQL Server Database hosted on a Web Server in my desktop application?

断了今生、忘了曾经 提交于 2021-02-20 02:55:55
问题 I have SQL Server Database which is present on some web server.I made a WPF or Windows form Desktop application using C# .Net.I want to retrieve data from sql server database in my desktop application as per end user requirements on its own local PC.Give me best way and best solution regarding security and accessing data. 回答1: You have 2 options. 1. Write the business logic layer which resides on the web-server and communicates with DB to serve the required data based on requests coming from

How I Retrieve Data from SQL Server Database hosted on a Web Server in my desktop application?

给你一囗甜甜゛ 提交于 2021-02-20 02:55:06
问题 I have SQL Server Database which is present on some web server.I made a WPF or Windows form Desktop application using C# .Net.I want to retrieve data from sql server database in my desktop application as per end user requirements on its own local PC.Give me best way and best solution regarding security and accessing data. 回答1: You have 2 options. 1. Write the business logic layer which resides on the web-server and communicates with DB to serve the required data based on requests coming from

How to customize legends in livecharts in winforms?

好久不见. 提交于 2021-02-20 02:45:30
问题 How to customize legends in livecharts in winforms ? I was trying to get some thing like this. In live chart winforms, I can only see these two options scatterChart.LegendLocation = LegendLocation.Right; scatterChart.DefaultLegend.Visibility = Visibility.Visible; But this wont help me to achieve a legend as I shown in the link. Would like to know some solutions. Thanks in advance. 回答1: We can create a DefaultLegend and add our properties into it and assign to chart's DefaultLegend as follows

How to determine when Rectangles overlap or intersect?

Deadly 提交于 2021-02-19 07:18:31
问题 I found out how to draw Rectangles and some code to find when two rectangles overlap but I can't connect these procedures. I have the two rectangles that I wanted but then a cannot determine whether these intersect, to then add this information to a ListBox. Here is my code: public partial class Form1 : Form { Graphics g; Pen p; Point cursor; int k = 0; Point[] tocke = new Point[2]; public Form1() { InitializeComponent(); g = this.CreateGraphics(); p = new Pen(Color.Black, 3); } private void

DateTimePicker selection only with DropDown

大憨熊 提交于 2021-02-19 07:01:44
问题 I want to use DateTimePicker in my Form, but I need user to select date only w/ DropDown and I'm trying to disable picking in DateTimePicker itself (e.g. by pressing KeyUp/Down). //this.dtp_datum_pracVykaz.ValueChanged += new System.EventHandler(this.dtp_datum_pracVykaz_ValueChanged); this.dtp_datum_pracVykaz.DropDown += dtp_datum_pracVykaz_DropDown; this.dtp_datum_pracVykaz.CloseUp += dtp_datum_pracVykaz_CloseUp; Where void dtp_datum_pracVykaz_DropDown(object sender, System.EventArgs e) {

Get data from barcode reader without textbox

感情迁移 提交于 2021-02-19 06:54:16
问题 My barcode reader is a HID type and use the USB. I can get the data when the text box is focus and do some business logic. private void Form1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyValue == (char)Keys.Return) { e.Handled = true; int barcodeLength = textBox1.TextLength; textBox1.Select(0, barcodeLength); queryData(textBox1.Text); } } After I google, I found this article and try to implement to my application. But the problem now, the value return with double character. If string is

How to Automate simple Windows Form Application using MSAA?

徘徊边缘 提交于 2021-02-19 06:45:08
问题 I want to automate simple Windows Application using MSAA. I am not getting Idea that how to find the control (say TextBox and Button ) and to get value of them(say get value of TextBox and click in case of button). 回答1: Why do you want to automate using MSAA? Microsoft's current way is UI Automation. From Wikipedia (emphasis mine): UIA is similar to Microsoft Active Accessibility (MSAA) in that it provides a means for exposing and collecting information about user interface elements and