1
A
답변
2
이 문제에 대한 해결책은 컨트롤의 상속에 따라 다릅니다. 일부는 Paint 메서드를 재정의해야하며 다른 일부는 ownerdraw가 필요합니다. 나는 일반적인 해결책을 모른다.
일부 Raize components에는 false로 설정할 수있는 ShowFocusRect
속성이 있습니다. 이는 잘 만들어진 구성 요소의 장점 중 하나입니다.
초점 사각형이 표준 Windows 사용자 인터페이스의 일부라고 주장하는 사람이 있습니다 (관련 토론은 here입니다). 어떤 상황에서는 행동을 재정의하기위한 경우가있을 것이라고 확신합니다.
0
다음은 this newsgroup post의 ownerdraw를 사용하여 StringGrid에서 초점 사각형을 표시하지 않는 예입니다. Paint 메서드에서 포커스 사각형이 그려지는 컨트롤에서는이 옵션이 작동하지 않습니다. false로 그리기
설정의 기본은 OnDrawCell 이벤트에이 첨부 :
procedure TMiscForm.StringGrid1DrawCell(Sender: TObject;
ACol, ARow: Integer;
Rect : TRect;
State : TGridDrawState);
var
SG: TStringGrid;
begin
if Sender is TStringGrid then
begin
SG:= TStringGrid(Sender);
SG.Canvas.Font:= SG.Font;
SG.Canvas.Brush.Color:= SG.Color;
SG.Canvas.Brush.Style:= bsSolid;
if gdFixed in State then
SG.Canvas.Brush.Color:= SG.FixedColor;
if (gdSelected in State) and not (gdFocused in State) then
begin
SG.Canvas.Brush.Color:= clHighLight;
SG.Canvas.Font.color := clHighLightText;
end;
SG.Canvas.Pen.Color := SG.Canvas.Brush.Color;
SG.Canvas.Pen.Mode := pmCopy;
SG.Canvas.Pen.Style := psSolid;
SG.Canvas.Pen.Width := 1;
SG.Canvas.Rectangle(Rect);
if SG.Canvas.Ctl3D and (gdFixed in State) then
begin
if goFixedVertLine in SG.Options then
begin
SG.Canvas.Pen.Color := clBtnHighLight;
MoveTo(Rect.Left, Rect.Bottom-1);
LineTo(Rect.Left, Rect.Top);
SG.Canvas.Pen.Color := clBtnShadow;
MoveTo(Rect.Right-1, Rect.Top);
if goFixedHorzLine in SG.Options then
LineTo(Rect.Right-1, Rect.Bottom)
else LineTo(Rect.Right-1, Rect.Bottom+SG.GridLineWidth);
end;
if goFixedHorzLine in SG.Options then
begin
SG.Canvas.Pen.Color := clBtnHighLight;
MoveTo(Rect.Left, Rect.Top);
LineTo(Rect.Right, Rect.Top);
SG.Canvas.Pen.Color := clBtnShadow;
if goFixedVertLine in SG.Options then
begin
MoveTo(Rect.Left+1, Rect.Bottom-1);
LineTo(Rect.Right, Rect.Bottom-1)
end
else
begin
MoveTo(Rect.Left, Rect.Bottom-1);
LineTo(Rect.Right + SG.GridLineWidth, Rect.Bottom-1);
end;
end;
end;
SG.Canvas.Brush.Style:= bsClear;
TextRect(Rect, Rect.Left + 2, Rect.Top + 2, SG.Cells[ACol,ARow]);
SG.Canvas.Brush.Style:= bsSolid;
if gdFocused in State then
SG.Canvas.DrawFocusRect(Rect);
end;
end;
0
을 스틸 관심을 항상 제어
procedure TfrmPic.MyStringGridDrawCell(Sender: TObject;
ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
// Deliberately draw focus rectangle which is subsequently redrawn;
if gdSelected in State then
MyStringGrid.Canvas.DrawFocusRect(Rect);
end; { procedure TfrmPic.sgCorDrawCell }
+0
일반적으로 작동합니까? OP는 해당 객체의 상속을 지정하지 않았습니다. – Argalatyr
관련 문제
- 1. NSCell에서 포커스 rect 제거.
- 2. 편집 컨트롤에서 키보드 포커스 제거
- 3. 편집 텍스트에서 포커스 제거
- 4. FpSpread에서 포커스 제거
- 5. WebBrowser 컨트롤에서 테두리 제거
- 6. ListBox 항목에서 포커스 사각형 제거
- 7. WebBrowser 컨트롤에서 호스팅되는 Flash 개체에 포커스 설정
- 8. telerik 컨트롤에서 모든 CSS 제거
- 9. 마우스를 끈 후에 SWF에서 포커스 제거
- 10. Jquery .change() 이벤트로 선택 상자에서 포커스 제거
- 11. ASP.Net 마법사 컨트롤에서 사이드 바 제거
- 12. 은색 텍스트 상자 컨트롤에서 포커스 사각형을 제거하는 방법
- 13. Adobe Air의 텍스트 입력 컨트롤에서 깜박이는 커서로 포커스 설정
- 14. Delphi 2005에서 패키지를 제거 할 수 없습니다.
- 15. 네이티브에서 액세스 Rect 클래스
- 16. 코코아 : NSView 드로잉 rect
- 17. android draw rect
- 18. rect.center가 rect 속성을 변경합니까?
- 19. WPF Rect Transform
- 20. NSString sizeWithAttributes : 내용 rect
- 21. NSTextView 상단의 커서 rect
- 22. 대화 상자 포커스 제공
- 23. MaskedTextBox 포커스 메서드가 작동하지 않습니다.
- 24. Delphi TWebBrowser 컨트롤에서 Flash Player를 백그라운드 스레드로 이동 하시겠습니까?
- 25. Silverlight에서 컨트롤의 포커스 감지
- 26. 블랙리스트의 포커스 피 포커스 문제
- 27. 자바 스크립트, 스윙, awt, 모든 개체에서 포커스 제거
- 28. 자바 스크립트에서 유효성 검사 - 포커스 오류 메시지 제거
- 29. 제안 된 후 jquery 자동 완성 포커스 제거
- 30. drawRect의 rect! = self.frame 때 조건
을 시도 할 수 있다면 나는이 오래된 질문이다 알지만? 관련된 세부 사항으로 더 나은 답변을 얻을 수 있습니다. – Argalatyr