winforms

How to make CefSharp WinForms control Scroll page to Link

柔情痞子 提交于 2021-02-19 06:39:06
问题 So here is the scenario, using CefSharp in a WinForms application. We have two pieces of information a page url and a link url within that page. We want to load the page - easily done, and have CefSharp show the area of the page where the link is located. That is cefsharp automatically scrolls to the right location on the page where that link is within the DOM. What is the easiest way of doing that? 回答1: Not sure which version you're using, I was able to solve this using the latest stable

How to change mouse cursor during drag and drop?

▼魔方 西西 提交于 2021-02-19 06:35:10
问题 Background: I have a C# winforms application. I am dragging information from one datagridview to another. For my drag over event on the destination grid, I have the following code: private void grid_DragOver(object sender, DragEventArgs e) { if(e.Data.GetDataPresent(typeof(SelectedRecordsCollection))) { e.Effect = DragDropEffects.Move; } } I want to limit the drop to only be allowed when the mouse is hovered over particular rows (say, rows with an odd index number). I currently limit what I

Draw border for NumericUpDown

妖精的绣舞 提交于 2021-02-19 06:13:36
问题 I have an user form in application. Some fields are validated. If field has wrong value red border is drawn for this control. It is made by handling Paint event for this control. I extended TextField and DateTimePicker to get Paint event from those classes objects. I have problem with NumericUpDown class. It does fire Paint event properly but invoking ControlPaint.DrawBorder(e.Graphics, eClipRectangle, Color.Red, ButtonBorderStyle.Solid); does completely nothing. Any ideas or suggestions? If

MMC process immediately closing, can't link to windows forms

主宰稳场 提交于 2021-02-19 05:36:05
问题 The end goal of what I am trying to do is get the MMC (Microsoft Management Console) Computer Management snap-in (compmgmt.msc) process to be embedded into a Windows Form, or a workaround that will treat it like a modal pop-up menu. Right now, I am just trying to get mmc.exe itself working, before I try to load a snap-in. The first part of the problem is the mmc.exe process almost exits immediately . Edit: mmc.exe only exits immediately if the application is built as 32-bit (my machine is 64

How to get the distance between the baseline of text and the horizontal border of a label?

不问归期 提交于 2021-02-19 04:07:31
问题 I want to get the exact distance between the baseline of the text and the bottom border of a label in C#. I want this because I want to draw a line under the text (don't want to use underlined font, because it's so tight/close to the text). Here is my try: //This is placed in the custom label class int dy = (int)((ClientRectangle.Height - Font.GetHeight())/2); But it's not exact, the dy returns about 3 and the line drawn to the label is too far from the baseline of the text. 回答1: To get text

Associating keys to buttons on a Windows Form

99封情书 提交于 2021-02-19 01:14:57
问题 I have to write a method on C# that associates a certain key (from the keyboard) to a specific button. For example, if I press A , the button that I created on a form application should appear like it is being pressed. 回答1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.KeyPreview = true; } private void button1_Click(object sender, EventArgs e) { System.Windows.Forms.MessageBox.Show("Ctrl-F was Pressed."

Associating keys to buttons on a Windows Form

只愿长相守 提交于 2021-02-19 01:14:48
问题 I have to write a method on C# that associates a certain key (from the keyboard) to a specific button. For example, if I press A , the button that I created on a form application should appear like it is being pressed. 回答1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.KeyPreview = true; } private void button1_Click(object sender, EventArgs e) { System.Windows.Forms.MessageBox.Show("Ctrl-F was Pressed."

How can I retrieve Latitude and Longitude of a postal address using Bing Maps?

故事扮演 提交于 2021-02-18 22:22:09
问题 I want to be able to retrieve the geographical coordinates (latitude and longitude) for a given address. I'm hoping I can do that if I have the full address (street address + city + state + zip). If it matters, I am using Bing Maps. The skeleton code I've got is this (fullAddress, AddPushpin(), and getGeoCordsForAddress() are the most pertinent parts): private void btnSave_Click(object sender, EventArgs e) { string fullAddress = string.Empty; if (MissingValues()) return; mapName = cmbxMapName

What is the difference between PaintEventArgs.ClipRectangle and PaintEventArgs.Graphics.ClipBounds

混江龙づ霸主 提交于 2021-02-18 21:07:45
问题 When overriding an OnPaint or OnPaintBackground method in an inheritor of System.Windows.Forms.Control, one argument is always a System.Windows.Forms.PaintEventArgs object. The partial object structure: PaintEventArgs ClipRectangle (System.Drawing.Rectangle) Graphics (System.Drawing.Graphics) Clip (System.Drawing.Region) ClipBounds (System.Drawing.RectangleF) VisibleClipBounds (System.Drawing.RectangleF) Graphics.Clip appears to be a 1-bit map of applicable pixels to influence in subsequent

What is the difference between PaintEventArgs.ClipRectangle and PaintEventArgs.Graphics.ClipBounds

China☆狼群 提交于 2021-02-18 21:06:49
问题 When overriding an OnPaint or OnPaintBackground method in an inheritor of System.Windows.Forms.Control, one argument is always a System.Windows.Forms.PaintEventArgs object. The partial object structure: PaintEventArgs ClipRectangle (System.Drawing.Rectangle) Graphics (System.Drawing.Graphics) Clip (System.Drawing.Region) ClipBounds (System.Drawing.RectangleF) VisibleClipBounds (System.Drawing.RectangleF) Graphics.Clip appears to be a 1-bit map of applicable pixels to influence in subsequent