將RTF的Padding設(shè)置比較大,例如10,此時我發(fā)現(xiàn)鼠標(biāo)移動到RTF的邊緣部分的時候(不超過Padding的范圍),滾動條就能夠顯示,一旦鼠標(biāo)移動到Content里面的時候,滾動條就不顯示
創(chuàng)新互聯(lián)建站10多年企業(yè)網(wǎng)站制作服務(wù);為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及高端網(wǎng)站定制服務(wù),企業(yè)網(wǎng)站制作及推廣,對自拌料攪拌車等多個方面擁有豐富的網(wǎng)站維護經(jīng)驗的網(wǎng)站建設(shè)公司。
1、滾動條分為水平滾動條(HSCROLLBAR)和垂直滾動條(VSCROLLBAR)兩種,可以作為輸入設(shè)備或者速度、數(shù)量的指示器來使用.
2、基本屬性:object.max[=value],object.min[=value],最大最小范圍 object.value[=value],
1.在mouse事件中實現(xiàn)
2.調(diào)用windows API
實現(xiàn)方式為:
1.在mouse事件中實現(xiàn)
[csharp] view plain copy
Point mouseOff;//鼠標(biāo)移動位置變量
bool leftFlag;//標(biāo)簽是否為左鍵
private void groupControl1_MouseUp(object sender, MouseEventArgs e)
{
if (leftFlag)
{
leftFlag = false;//釋放鼠標(biāo)后標(biāo)注為false;
}
}
private void groupControl1_MouseMove(object sender, MouseEventArgs e)
{
if (leftFlag)
{
Point mouseSet = Control.MousePosition;
mouseSet.Offset(mouseOff.X, mouseOff.Y); //設(shè)置移動后的位置
Location = mouseSet;
}
}
private void groupControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mouseOff = new Point(-e.X, -e.Y); //得到變量的值
leftFlag = true; //點擊左鍵按下時標(biāo)注為true;
}
}
private void groupControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mouseOff = new Point(-e.X, -e.Y); //得到變量的值
leftFlag = true; //點擊左鍵按下時標(biāo)注為true;
}
}
2.調(diào)用windows API
調(diào)用前需要添加using System.Runtime.InteropServices;
[csharp] view plain copy
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private void groupControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture(); //釋放鼠標(biāo)捕捉
//發(fā)送左鍵點擊的消息至該窗體(標(biāo)題欄)
SendMessage(Handle, 0xA1, 0x02, 0);
}
}
控件是可以顯示在里面的,你只要加個label,把label的屬性設(shè)為visualble=fause就行。設(shè)置鼠標(biāo)經(jīng)過頭像的mouseHover和mouseLeave事件,當(dāng)mouseHover時label的屬性visualble=true,當(dāng)mouseLeave時label的屬性visualble=fause即可。窗體的鼠標(biāo)事件可以設(shè)置控件的cursor屬性,里面可以選擇許多種鼠標(biāo)圖形。 只要是正常的Form都可以改變窗體大小,但是無邊框的窗體只能用函數(shù)改變或者設(shè)置屬性,在debug后是不能改變的。拖動窗體需要在窗體的load時間里面寫入當(dāng)鼠標(biāo)單擊不放時的事件即可,不難。
您好,建議您使用mouse_event或者?Cursor.Position來實現(xiàn)。例如:
1. 您需要將鼠標(biāo)移動dx, dy的位置。
Public?Sub?MouseMoveBy(ByVal?dx?As?Integer,?ByVal?dy?As?Integer)
Cursor.Position?=?New?Point(Cursor.Position.X?+?dx,?Cursor.Position.Y?+?dy)
End?Sub
或者
Public?Sub?MouseMoveBy(ByVal?dx?As?Integer,?ByVal?dy?As?Integer)
mouse_event(0,?dx,?dy,?0,?0)
End?Sub
2. 您需要將鼠標(biāo)移動到x, y的位置
Public?Sub?MouseMoveTo(ByVal?x?As?Integer,?ByVal?y?As?Integer)
Cursor.Position?=?New?Point(x,?y)
End?Sub
請您試一下。
調(diào)用api
在Visual Baisc.net中的聲明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模擬鼠標(biāo)左鍵按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模擬鼠標(biāo)左鍵釋放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模擬鼠標(biāo)中間鍵按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模擬鼠標(biāo)中間鍵釋放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模擬鼠標(biāo)右鍵按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模擬鼠標(biāo)右鍵釋放
Public Const MOUSEEVENTF_MOVE = H1 '模擬鼠標(biāo)指針移動
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模擬鼠標(biāo)左鍵按下