:)
hwswin
Posts
-
Accessing the user.config file on a newly installed application from the installer itself -
Accessing the user.config file on a newly installed application from the installer itselfHow about this
AppDomain.CurrentDomain.BaseDirectory
I think you deploy the project use the clickonce,am I right?
-
Accessing the user.config file on a newly installed application from the installer itselfApplication.UserAppDataPath
It'll return like follow: "C:\\Documents and Settings\\mis-hongwenshi\\Application Data\\ccc\\WindowsApplication11\\1.0.0.0"
-
Accessing the user.config file on a newly installed application from the installer itselfprotected override void OnAfterInstall(System.Collections.IDictionary savedState) { string t\_path = this.Context.Parameters\["assemblypath"\].ToString(); Configuration \_usrConfigLoc = System.Configuration.ConfigurationManager.OpenExeConfiguration(Path.Combine(t\_path,"user.config")); //... base.OnAfterInstall(savedState); }
-
Excel interop - 80080005 error [modified]The problem is, intermittently i get the error: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005. It throw up when I use:
Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
and it happens randomly. What could be the reason? Dose anyone have any experience with this,thanks in advance for ur assistance.
modified on Wednesday, June 23, 2010 5:15 AM
-
Get Checked value of a checkBox from thread different of the UI threadI have an other Thread t,and I can get the checkbox value from UI thread in Thread t. see follow source code.
private void Form2\_Load(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(deal)); t.Name = "deal"; t.IsBackground = true; t.Start(); } void deal() { while (true) { System.Diagnostics.Debug.WriteLine(checkBox1.Checked); Thread.Sleep(1000); } }
-
Why I can't get the WM_CREATE msg in the PreFilterMessage methodThks again! Greate,Use the hook can figure out my "Question".
[See here](http://support.microsoft.com/default.aspx?scid=kb;en-us;318804)[[^](http://support.microsoft.com/default.aspx?scid=kb;en-us;318804 "New Window")]
-
Why I can't get the WM_CREATE msg in the PreFilterMessage methodIt seems it wasn't catch by PreFilterMessage. Is there some way to catch WM_CREATE for all forms in my application without override those WndProc in each winform?
-
Why I can't get the WM_CREATE msg in the PreFilterMessage methodThanks, I remove the override method of WndProc from form1,but it didn't work fine.
PS:
We can capture all msgs except the WM_CREATE in PreFilterMessage method.N a v a n e e t h wrote:
Also use this[^] overload of Application.Run.
I have changed
Form1 f = new Form1(); f.Show(); Application.Run();
toApplication.Run(new Form1());
May be I didn't clear what you mean. -
Why I can't get the WM_CREATE msg in the PreFilterMessage methodI can get the WM_CREATE msg in WndProc when I click button1,but it didn't fired at the PreFilterMessage. Follow is the source code.Thanks!
static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> \[STAThread\] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); filter ft = new filter(); Application.AddMessageFilter(ft); Form1 f = new Form1(); f.Show(); Application.Run(); } } public class filter : IMessageFilter { #region IMessageFilter 成员 const int WM\_CREATE = 0x00001; public bool PreFilterMessage(ref Message m) { `if (m.Msg == WM_CREATE) { MessageBox.Show("A"); return true; }` return false; } #endregion } public partial class Form1 : Form { #region Designer /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(0, 0); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1\_Click); // // Form1 // this.AutoScaleDimensions = new
-
How can i get the VISIBLE bounds of a control. [modified]change the
p.Width = 1.5f;
top.Width = 10f;
you can see the left and top line were drawed. -
How can i get the VISIBLE bounds of a control. [modified]I think the cause is the graphics,which belong to panel1(the parent of groupbox1),we drawed the rectangle on the panel1 but it just under the groupbox1.So the rectangle we drawed were cover by the groupbox1.
-
How can i get the VISIBLE bounds of a control. [modified]Thanks again!
Rob Philpott wrote:
The right and bottom line are probably not appearing because they're outside the clip rectangle
I use the
Inflate(-2, -2)
to make sure the Rectangle was inside the clip rectangle,but they're still not appearing. follow is the test code.using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace draw
{
public partial class Form1 : Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.groupBox1); this.panel1.Location = new System.Drawing.Point(192, 141); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(200, 100); this.panel1.TabIndex = 0; // // groupBox1 // this.groupBox1.Location = new System.Drawing.Point(91, 43); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(200, 100); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "groupBox1"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(6
-
How can i get the VISIBLE bounds of a control. [modified]Ok,I get it,follow
ctrlP = ctrl.Parent;
Rectangle r = ctrl.Bounds;
Rectangle rP = new Rectangle(0, 0, ctrlP.Width, ctrlP.Height);
r.Intersect(rP);but I have new issue,I want to draw the border of the "display bound"
Graphics g = ctrlP.CreateGraphics();
Pen p = new Pen(Color.Red);
p.Width = 1.5f;g.DrawRectangle(p, r);
g.Dispose();It draw the top and the left line fine,but the right and the bottom line were clear,because OnPaint event of ctrl? and this method was fired in Form_Paint(object sender, PaintEventArgs e).
-
I want to do a control like vs2005 doc outline toolSo if I want to make it, I need to consider all those special controls, It's not a easy thing,right?
Did anybody have idea about how display all controls in winfroms at runtime like vs2005 doc outline tool in designtime?
-
How can i get the VISIBLE bounds of a control. [modified]Thanks! I have two container controls like follow "a" and "b" ┌────┐ | | | a | | | └────┘ ┌───────┐ | | | b | | | └───────┘ b is bigger than a And I drag b into a,so b only display the visible area and I want to get that,not b.bounds ┌────┐ | a┌──┤ | | | | | b | └─┴──┘ how can I get it?
-
How can i get the VISIBLE bounds of a control. [modified]I can give the rectangle of a control by bounds.but I don't know how get the visble rectangle when a control not display whole.
Rectangle r = ctrl.Bounds;
ctrl.DisplayRectangle;:confused:
modified on Thursday, June 11, 2009 12:25 AM
-
I want to do a control like vs2005 doc outline toolThanks for your reply I had already use the recursive method-->"addNode(Control ctrl, TreeNode tn)"
-
I want to do a control like vs2005 doc outline tool...f is a Form Control t_ctrl; for (int i = 0; i < f.Controls.Count; i++) { t_ctrl = f.Controls[i]; TreeNode t_tn = new TreeNode(string.IsNullOrEmpty(t_ctrl.Text) ? t_ctrl.Name : t_ctrl.Text); t_tn.Tag = t_ctrl; self.treeView1.Nodes.Add(t_tn); addNode(t_ctrl, t_tn); } ... private static void addNode(Control ctrl, TreeNode tn) { Control t_ctrl; for (int i = 0; i < ctrl.Controls.Count; i++) { t_ctrl = ctrl.Controls[i]; TreeNode t_tn = new TreeNode(string.IsNullOrEmpty(t_ctrl.Text) ? t_ctrl.Name : t_ctrl.Text); t_tn.Tag = t_ctrl; tn.Nodes.Add(t_tn); if (t_ctrl.Controls.Count != 0) { addNode(t_ctrl, t_tn); } } &nb